O365 Webhook Subscriptions for All Users Calendars - microsoft-graph-api

There is an existing question which already has an answer; however, the answer comes from a Microsoft developer and reads, "We are working to support the scenario you are requesting..." and goes on to provide a method which doesn't seem to answer my question.
Original article: Using Microsoft graph to read all users calendars
My question is, rather than subscribing to a single user's mailbox or calendar, is it possible to subscribe to all mailboxes or calendars?
My application needs to listen to the create/update/delete events of calendar meetings and insert them into a SharePoint list.
POST https://graph.microsoft.com/v1.0/subscriptions
Content-type: application/json
{
"changeType": "created,updated",
"notificationUrl": "https://webhook.azurewebsites.net/api/send/myNotifyClient",
"resource": "me/mailFolders('Inbox')/messages",
"expirationDateTime":"2016-11-20T18:23:45.9356913Z",
"clientState": "subscription-identifier"
}
References:
Using Microsoft graph to read all users calendars
Creating a subscription - https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/subscription_post_subscriptions

This feature is not available today. If you'd like to request this feature you can create an idea on uservoice

Related

Failed to find user in SharePoint after the user is added to a team in MS Teams using Microsoft Graph API

We added a user to a team using MS Graph API
POST https://graph.microsoft.com/v1.0/teams/<team-id>/members
Content-type: application/json
{
"#odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["member"],
"user#odata.bind": "https://graph.microsoft.com/v1.0/users('<user-id>')"
}
Then we wanted to add this user to a SiteGroup in SharePoint connected to the team. We want to use these SiteGroups to control access of uploaded files.
Unfortunately MS Graph API cannot support this operation. Thus we have to use SharePoint REST API.
First of all we have to find the user in SharePoint.
https://<my-domain>.sharepoint.com/sites/<site-id>/_api/Web/SiteUsers?$filter=Email eq '<user-email>'
But this call returns an empty list.
We can add the user manually using SharePoint admin tool: https://<my-domain>.sharepoint.com/sites/<site-id>/_layouts/15/people.aspx?MembershipGroupId=<SiteGroup-id>
The Sharepoint can see this new user but the REST API cannot.
One day later the user appeared in the list of SiteUsers:
https://<my-domain>.sharepoint.com/sites/<site-id>/_api/web/SiteUsers
Is there a faster way to add user to a team and also add this user to a SharePoint SiteGroup?

Teams Permissions for Reading and Writing Chat Messages

I am building a workflow that posts a message to a specific person in teams for review and approval. I believe I have the API call correct, but I keep getting this.
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
What permissions or privileges do I need to interact with the API? Does the Application/User have to be an administrator?
You can send simple messages, messages with #mentions and cards to chat of a user or in a channel using a graph APIs:
To send chat message in a channel, call
POST https://graph.microsoft.com/beta/teams/{id}/channels/{id}/messages
To send message to chat, call
POST https://graph.microsoft.com/beta/chats/{id}/messages
For more information related to permissions and request details refer API document.
Administrator have to enable delegated Graph API permissions as listed in document, by registering an app in Azure to avail these APIs in Source code.

How to subscribe calendar event if calendar is given delegated permission using ms-graph api

Change notifications of Outlook events can be created by subscribing following way using ms graph api .
{
"changeType": "created,updated,deleted",
"notificationUrl": "notificationUrl",
"resource": "Users/xxx169f-xxx-xxxx-afd2-936c51e6xxxx/Events",
"expirationDateTime":"2016-11-20T18:23:45.9356913Z",
"clientState": "secretClientValue"
}
but how do i get notifications similar way for calendars that have given delegated permission ?
You can validate that you can access the shared calendar via API by using this with Calendar.Read.Shared
GET https://graph.microsoft.com/v1.0/users/adelev#m365x874506.onmicrosoft.com/events
In this example, AdeleV has shared her calendar with MeganB. And I'm signed in as Megan B to Graph Explorer. https://developer.microsoft.com/en-us/graph/graph-explorer?request=users/adelev#m365x874506.onmicrosoft.com/events&method=GET&version=v1.0&GraphUrl=https://graph.microsoft.com
Unfortunately you cannot subscribe to events as per the note on this docs page https://learn.microsoft.com/en-us/graph/outlook-get-shared-events-calendars?view=graph-rest-1.0
Note The sharing permissions (Calendars.Read.Shared or Calendars.ReadWrite.Shared) allow you to read or write events in a shared or delegated calendar. They do not support subscribing to change notifications on items in such folders. To set up change notification subscriptions on events in a shared, delegated, or any other user or resource calendar in the tenant, use the application permission, Calendars.Read.

Microsoft Graph - Get Access Token

I would like to create a backend Node.js aplication in order to manage an Outlook Calendar (Create, delete, update events...). However I want to update the same calendar every time (Always the same account). A global calendar to everyone.
The real pourpose is to integrate this calendar Backend with dialogFlow functionality (Similar to this example in Google Calendar https://github.com/dialogflow/fulfillment-bike-shop-nodejs)
I've been looking to https://learn.microsoft.com/en-us/graph/auth-v2-service, but I don't know if it is the correct aproach to do it.
I created an app in Azure Portal, and got my token:
POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token HTTP/1.1
But can't access to https://graph.microsoft.com/v1.0/users/{id}/calendars. The message I get is similar to this:
"code": "OrganizationFromTenantGuidNotFound",
"message": "The tenant for tenant guid '68cc4dcb-5873-4ea0-a498-fe57e9b5d827' does not exist."
I've been looking to
https://learn.microsoft.com/en-us/graph/auth-v2-service, but I don't
know if it is the correct aproach to do it.
I think this is feasible.
"code": "OrganizationFromTenantGuidNotFound",
You need to use the user(tonyju#abc.onmicrosoft.com) to access calendars. And this account must have been assigned a O365 license You can refer to this.
Update:
If you just want to access the calendar of your personal account, you can use auth code flow to get the access token. And then use
https://graph.microsoft.com/v1.0/me/calendars

Create Skype meeting event in Microsoft Graph API

I am creating events using the Microsoft Graph API
https://graph.microsoft.com/v1.0/me/events
I am able to schedule meetings with other user. But now question is how I will communicate with that user on the scheduled day or time.
can we add skype meeting as location while scheduling meeting?
or any other way to communicate with the users?
Thanks
Today the Skype for Business APIs are not exposed through the Microsoft Graph and I doubt they will ever be considering Microsoft is investing heavily on Microsoft Teams.
As of today the Microsoft Teams APIs only allow you to CRUD teams and channels, manage tabs and post messages to channels (still beta).
If you want to interact with Skype For Business you have to use the UCWA API where you can create a meeting.
Then you can update your Exchange Event with the S4B online meeting information so the users can access the meeting.
You can create a Microsoft Teams meeting call by adding in the body of your JSON a "contentType" : "HTML",
"content": Call link https://aka/ms:mmkvlb"
This can be found in the Graph Explorer page when you choose a POST method in "add graph community call", which is accessible in the Outlook Calendar Sample Category.
I think that you can also open this link with Skype.
For more information check: "https://developer.microsoft.com/en-us/graph/graph-explorer#"

Resources