How to authenticate SharePoint with custom app

How to authenticate SharePoint with custom app

Procore to SharePoint custom app creation:

1. Login to https://portal.azure.com and click "App registrations"

2. Click "New registration"

3. Provide custom app name and In the supported account types select "Any Entra ID Tenant + Personal Microsoft Accounts"

5. Click "Register"

6. Click "API permissions Add API permissions to Favorites"

7. Click "Add a permission"

8. Click "Microsoft Graph"

9. Click "Deligated Permissions"

10. Select "Sites.Selected" permission under "Sites"

11. Click "Add permissions"

12. Click "Add a permission" again

13. Click "Microsoft Graph" again

14. Click "Application Permissions"

15. Select "Sites.Selected" permission under "Sites"

16. Click "Add permissions"

17. Click "Grant admin consent for SyncEzy"

18. Click "Grant admin consent confirmation"

19. Click "Certificates & Secrets"

20. Click "New client secret"

21. Enter Description and select "Expires in 24 months."

22. Click "Add"

23. Copy the Value Key and store it securely, as it will be required later.

Copy the Value Key and store it securely, as it will be required later.

24. Click "Overview"

25. Copy the Client ID Key and store it securely, as it will be required later.

Copy the Client ID Key and store it securely, as it will be required later.

27. Once Signed-in Click "Consent to permissions"

28. Click "Sites"

29. Click “Consent to Sites.FullControl.All”. This permission is temporary and will be removed once access has been granted for the specific site, after which the app will be deleted.

30. Click "Accept"

31. Click "Close"

32. Copy the SharePoint site URL

Copy the SharePoint site URL up to the site name. In this example, it would be:

syncezy2.sharepoint.com/sites/WashingtonTownHall (as shown in the screenshot below).

Then append it to the base URL:

https://graph.microsoft.com/v1.0/sites/

So the final format becomes: https://graph.microsoft.com/v1.0/sites/syncezy2.sharepoint.com:/sites/WashingtonTownHall


Copy the SharePoint site URL

33. Paste the complete URL and hit Run query

Paste the complete URL and hit Run query

34. Copy the "id" that you get in response, copy it and repalce it with the part that is after https://graph.microsoft.com/v1.0/sites/ in URL

35. Change the request method to "POST"

36. Paste the below payload in Request body

{
    "roles": [
        "write"
    ],
    "grantedToIdentities": [
        {
            "application": {
                "id": "",
                "displayName": ""
            }
        }
    ]
}


Paste the below payload in Request body

37. In the id field, paste the Application ID (Client ID) that you saved earlier for the custom app. In the displayName field, enter the app name you assigned to the custom app in the begining..

In the id field, paste the Application ID (Client ID) that you saved earlier for the custom app. In the displayName field, enter the app name you assigned to the custom app in the begining..

38. Add /permissions in the end of URL and then click "Run query". Once the query is executed, proceed to authenticate the app on the SyncEzy portal.

39. Click "Connect" Sharepoint

40. Click "Advance Auth"

41. Enter the custom app Client/Application ID and the Secret Value Key that you saved earlier. Then copy the full SharePoint site URL you want to connect to the integration, paste it into the field, and click Connect.
This will direct you to Microsoft sign in page, add your valid credentials. Upon successful login, connection is successful. 

42. Now the Graph app with full site permissions can be deleted.

To delete navigate to https://entra.microsoft.com/ and select Graph Explorer app under Enterprise apps.


Now the Graph app with full site permissions can be deleted.

43. Click "View properties"

44. Click "Delete"

45. Click "Yes" to delete it.