Tag Archives: Graph explorer

Using microsoft graph to Retrieve user by ImmutableId


You can use Microsoft Graph API to access the Azure Active Directory resources. For the given scenario we used the onPremisesImmutableId property to retrieve the user. To test this out, you can use Microsoft Graph Explorer as well and test it by granting the right set of permissions in it.

Here’s the query that i used:

https://graph.microsoft.com/v1.0/users?$filter=onPremisesImmutableId+eq+'{id}’

Microsoft Graph Explorer – snapshot:
image

Hope this helps.

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!!

Microsoft GRAPH API Developer: TO DO API is General Available now!!


Previously, the TO DO API was available through the beta endpoint only; now you can access it through the production v1.0 endpoint. In this API, it have a todoTaskList entity, consisting of a collection of todoTask entities, also new entity called linkedResource, which enables task completion. You can use it to store and display the link back to the item in your app from where the task was created.

What you need?

  • The new API supports personal (MSA) and work and school accounts.
  • The required permission scope to access the API is Tasks.ReadWrite.
  • All the resources support CRUD operations.

How to use:

CRUD operation on todoTaskList entity –  /me/todo/lists

CRUD operation on todoTask entity –  /me/todo/lists/<listId>/tasks

CRUD operation on linkedResource entity –  /me/todo/lists/<listId>/tasks/<taskId>/linkedResources

Feel free to test the API in Microsoft Graph explorer or use it in your production application!!

Hope this helps.

Microsoft Graph API – How to get properties of a file attachment?


Ok let we try to get the properties of a file attachment like its id, lastmodifieddatetime, name, contenttype, size, isinline attachment, contentid, contentbytes etc.


Request
:

GET https://graph.microsoft.com/v1.0/me/messages/AAMkAGUzY5QKjAAA=/attachments/AAMkAGUzY5QKjAAABEgAQAMkpJI_X-LBFgvrv1PlZYd8=


Response
:

HTTP/1.1 200 OK
Content-type: application/json

{
     “@odata.context”: “https://graph.microsoft.com/v1.0/$metadata#users(‘bb8775a4-4d8c-42cf-a1d4-4d58c2bb668f’)/messages(‘AAMkAGUzY5QKjAAA%3D’)/attachments/$entity”,
     “@odata.type”: “#microsoft.graph.fileAttachment”,
     “id”: “AAMkAGUzY5QKjAAABEgAQAMkpJI_X-LBFgvrv1PlZYd8=”,
     “lastModifiedDateTime”: “2019-04-02T03:41:29Z”,
     “name”: “Draft sales invoice template.docx”,
     “contentType”: “application/vnd.openxmlformats-officedocument.wordprocessingml.document”,
     “size”: 13068,
     “isInline”: false,
     “contentId”: null,
     “contentLocation”: null,
     “contentBytes”: “UEsDBBQABgAIAAAAIQ4AAAAA”
}

Hope this helps.

Using Microsoft Graph API to get all the rules for the given users inbox


You can use Microsoft Graph API in order to get all the messageRule objects defined for the user’s Inbox.

It’s straightforward. You can try one of the following:

Request:
GET /me/mailFolders/inbox/messageRules
GET /users/{id | userPrincipalName}/mailFolders/inbox/messageRules

Response:
HTTP/1.1 200 OK
Content-type: application/json

{
     “@odata.context”: “https://graph.microsoft.com/v1.0/$metadata#users(’48d31887-5fad-4d73-a9f5-3c356e68a038′)/mailFolders(‘inbox’)/messageRules”,
     “value”: [
         {
             “id”: “AQAAAI-fmCo=”,
             “displayName”: “If magic rule”,
             “sequence”: 1,
             “isEnabled”: true,
             “hasError”: false,
             “isReadOnly”: false,
             “conditions”: {
                 “bodyOrSubjectContains”: [
                     “abracadabra”
                 ]
             },
             “actions”: {
                 “assignCategories”: [
                     “Magic”
                 ],
                 “stopProcessingRules”: true
             }
         }
     ]
}

Hope this helps.

Fixed: In Exchange Hybrid scenario Microsoft Graph REST API query fails due to $select $top $skips commands ignored


Recently i was working with an app developer who’s using Microsoft Graph REST API in their application. They try to query contacts for Exchange 2016 CU5 on premises in a hybrid + Office 365 environment (they had one single mailbox setup in Office 365).

When they tested the Graph API query with $select, $top, $skips commands they lead to failure. Here is the related query: https://graph.microsoft.com/v1.0/me/contacts?$select=displayName,emailAddresses,id&$top=2&$skip=0

I tested the query against my Office 365 account and it works. But on Hybrid scenario (Exchange 2016 on premises + Office 365) account it completely ignores the $select $top $skip commands, returns all contacts instead of just the top 2 and doesn’t filter out the data like it should.

In addition, we see Status code 200 when we ran the same query from Office 365 GraphExplorer (for the same scenario):

Le Café Central de DeVa - Deva blogs

Based on this, we worked internally, investigated, fixed and it was rolled out. The issue is fixed now Smile

So now you can test the above Microsoft Graph API query in Hybrid (Office 365 + Exchange Server 2016 CU5) scenario and it works as expected.

Office 365 Developers – Catch up on Outlook APIs in Microsoft Graph


https://channel9.msdn.com/Events/Build/2017/P4123/player

 

In Build 2017, i attended good number of sessions virutally, including this one by Venkat Ayyadevara, Program Manager, Outlook EcoSystem about Outlook API’s in Microsoft Graph. In this, you can learn about recent updates in Microsoft Graph for accessing Outlook mail, calendar, contacts and more for millions of commercial and consumer users.

You can also learn about the new updates to People APIs in Microsoft Graph that provide information about the people who are important to you across mail, contacts, and social networks, with powerful search capabilities and findmeetingtimes etc.

Hope this helps.