Tag Archives: scopes

while try to Create new contact using microsoft graph explorer throws http 403


Ok, recently i got a chance to create a new contact in Office 365 using Microsoft Graph API. I used Microsoft Graph Explorer for it.

I got the error HTTP 403 Forbidden at Graph Explorer and in the response we see that “ErrorAccessDenied”. It’s telling that you need permissions to make the above API call successful.

Note:  Also you may want to validate your token in https://jwt.ms as well to make sure that you have necessary permissions/scopes or not.

Le Cafe de Deva - Deva Blogs © 2021

In order to proceed further, you need to provide consent to the necessary permissions required at “Modify Permissions” in Graph Explorer.

Le Cafe de Deva - Deva Blogs © 2021

Select the consent button in you will see the permissions requested popup, provide your consent as well.

Le Cafe de Deva - Deva Blogs © 2021

Right after the above successful step, i went back to Microsoft Graph Explorer, tested the API – it worked like a charm. Hope this comes handy to you.

Happy Graph coding!!

Office 365 Developer: Using People API with Microsoft Graph v1.0


Microsoft Graph provides access to useful people data. You can use the person resource and the People API to aggregate information about a person from across mail, contacts, and social networks. The results are ordered by their relevance based on multiple communication and collaboration patterns and business relationships. The API lets you browse, sort, select, filter, or search for persons based on your criteria. Now the People API is available in Microsoft Graph v1.0.

To learn more about how to use the People API in v1.0, see our reference documentation and the article Get information about relevant people.

This API now requires one of two scopes: People.Read or People.Read.All.

  • People.Read will continue to be required for general People API calls, for example https://graph.microsoft.com/beta/me/people/. People.Read will require end user consent.
  • We are introducing People.Read.All; which will be required to retrieve the people most relevant to a specified user in the signed-in user’s organization (https://graph.microsoft.com/v1.0/users(‘{id}’)/people) calls. People.Read.All will require admin consent.

So i went ahead, played with People API against my test Office 365 mailbox. I see the following:

Request:

GET V1.0
https://graph.microsoft.com/v1.0/users(‘{b0386fe0-30d5-4e1d-b1ad-55bf082db9b8}’)/people

Response:

{
     “@odata.context”: “https://graph.microsoft.com/v1.0/$metadata#users(‘%7Bb0386fe0-30d5-4e1d-b1ad-55bf082db9b8%7D’)/people”,
     “value”: [
         {
             “id”: “b0386fe0-30d5-4e1d-b1ad-55bf082db9b8”,
             “displayName”: “Melissa Darrow”,
             “givenName”: “Melissa”,
             “surname”: “Darrow”,
             “birthday”: “”,
             “personNotes”: “”,
             “isFavorite”: false,
             “jobTitle”: “Marketing Director”,
             “companyName”: null,
             “yomiCompany”: “”,
             “department”: “Sales & Marketing”,
             “officeLocation”: “131/1105”,
             “profession”: “”,
             “userPrincipalName”: “MelissaD@CIE493742.onmicrosoft.com”,
             “imAddress”: “sip:melissad@cie493742.onmicrosoft.com”,
             “scoredEmailAddresses”: [
                 {
                     “address”: “MelissaD@CIE493742.onmicrosoft.com”,
                     “relevanceScore”: 1
                 }
             ],
             “phones”: [
                 {
                     “type”: “mobile”,
                     “number”: “+1 206 555 0110”
                 }
             ],
             “postalAddresses”: [],
             “websites”: [],
             “personType”: {
                 “class”: “Person”,
                 “subclass”: “OrganizationUser”
             }
         }
     ]
}



Still if you’re interested, you can go ahead and test the following as well:


Get a collection of relevant people

GET https://graph.microsoft.com/v1.0/me/people/

Request a subsequent page of people

GET https://graph.microsoft.com/v1.0/me/people/?$top=3&$skip=10

Sort the response

GET https://graph.microsoft.com/v1.0/me/people/?$orderby=displayName

Select the fields to return

GET https://graph.microsoft.com/v1.0/me/people/?$select=displayName,scoredEmailAddresses

Test123

Hope this helps Smile