ServiceNow Outbound Rest Message to MS Graph Api to obtain users Out Of Office details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 05:27 AM
I need to create a REST message to retrieve Out Of Office details from Azure/O365.
Previously we used a SOAP message to Exchange Web Services which worked, until MS deprecated the Basic Authentication method and now need OAuth.
Requirements/Steps:
1) Register ServiceNow as App in Azure tenancy (done) and add correct MS Graph API permission (partially done).
2) Generate OAuth credentials in Azure for SN App (done).
3) Setup OAuth Authentication record in SN to allow SN to connect to Azure - Application Registry, using the Client ID and Secret from step 2, This creates a default Authentication Profile too (done).
4) Test from the Application Registry record you obtain an OAuth token OR by creating a new Credentials record (done) using the Credentials method we can see what Scopes/Permissions are available for the MS Graph Endpoint.
5) If all above successful, create Rest Message to obtain OOO details using the OAuth Authentication profile details to connect (issues are here).
Step 5 is where the issues are, Im having trouble determining the correct MS Graph Endpoints and setting the right Permission (Delegated or Application) for the SN App in Azure and adding them as Scopes in the Application Registry record in SN.
I believe the API needed to use to get Out of Office details is a - GET: https://graph.microsoft.com/v1.0/users/{UserID or Email}/mailboxSettings/automaticRepliesSetting
Has anyone successfully configured all Steps, your help very much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 03:47 AM
Hi
i am having the same issue with permissions. I belive it is on AAD side where this is set but checking the token in jwt.ms: Welcome! it shows no permissions at all
permissions set as follows in AAD
error message is
{"error":{"code":"Authorization_RequestDenied","message":"Insufficient privileges to complete the operation