I am hoping someone can help me. I am having trouble developing an application that has the capability of modifying the contacts in a given Office 365 account without the User.
I am following this documentation: https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_service and have double checked for proper parameters in my URL.
Due to the nature of my environment, I will not be able to use any built in Outlook libraries, instead I am doing this using HTTPS streams.
I have:
- Registered my application
- Set the correct Application Permissions: Contacts.ReadWrite (Admin Only)
- Gained Administrator Permission according to the documentation
- Retrieved the Authorization Token in my application
String ClientID = "client_id=<Client_ID>";
String Scope = "&scope=api://localhost/<Application ID>/.default";
String ClientSecret = "&client_secret=<Client Secret>";
String GrantType = "&grant_type=client_credentials";
Request to: https://login.microsoftonline.com/<Domain GUID>/oauth2/v2.0/token
- Requested to Read the Contacts: Failed.
Request: https://graph.microsoft.com/v1.0/users/<User Object ID>/contacts
Response: 401 - Invalid Token
Does anyone have any thoughts on what could possibly be wrong here? I have gone through the documentation and checked the parameters over and over with no luck.