0

I am attempting to write a service to take an action when a calendar event occurs. ie Appoint due in 15 min warning. Multiple users will need to be able to register with the service. I think Subscriptions are the what I need, although what "ChageType" to use to get an alert, I have not gotten to yet. Right now I get "Exchange Online resources are not supported for MSA requests." when I try to use this code. I am working against an outlook.com account.

GraphServiceClient graphClient = SDKHelper.GetAuthenticatedClient();

var subscription = new Microsoft.Graph.Subscription();
subscription.ChangeType = "updated";
subscription.ExpirationDateTime = System.DateTime.UtcNow.AddDays(1);
subscription.ClientState = System.Guid.NewGuid().ToString();
subscription.NotificationUrl = "https://mywebhook.azurewebsites.net/api/send/myNotifyClient"; // must be valid and able to verify?

subscription.Resource = "me/events";
var newsub = await graphClient.Subscriptions
                     .Request().AddAsync(subscription);
jlo-gmail
  • 4,453
  • 3
  • 37
  • 64

2 Answers2

0

Subscriptions to Outlook.com ARE supported by the nugget package: Microsoft.Office365.OutlookServices-V2.0 that wraps the Outlook365 API.

https://msdn.microsoft.com/en-us/office/office365/api/notify-rest-operations

I got it working -- sort of using: https://github.com/jasonjoh/dotnet-tutorial combined with: aspnet-webhooks-rest-sample

So far I can create a subscription using an MVC App and capture User Info + Client State; at the webhook I can capture client state and subscription id along with a Change Type and Resource ID:

https://outlook.office.com/api/v2.0/Users('0003bffd-a898-60b1-0000-000000000000@84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa')/Messages('AQMkADAwATNiZmYAZC1hODk4LTYwYjEtMDACLTAwCgBGAAADhL94GyFZe0WMH6_2kacBNAcAVYqcEoTpoEy-bsETzU244wAAAgEKAAAAVYqcEoTpoEy-bsETzU244wAAAFP_o9AAAAA=')

Unfortunately, no information about the "item" is provided.

Update: using info from MVC 5 application - implement OAuth Authorization code flow I am able to get "Authorization Code Flow" working - still need to figure out how to Authenticate OWIN (so the MVC app has a Logon Identity) using an access_token.

Community
  • 1
  • 1
jlo-gmail
  • 4,453
  • 3
  • 37
  • 64
-1

It is currently not supported to use MS accounts for subscriptions on several resources. Instead the mailbox must use a "work or school" account.

See https://stackoverflow.com/a/41026203/270142 for further details.

Community
  • 1
  • 1
RasmusW
  • 3,355
  • 3
  • 28
  • 46
  • Subscriptions to Outlook.com ARE supported by the nugget package: Microsoft.Office365.OutlookServices-V2.0 that wraps the Outlook365 API. actually have this working in pieces -- the authentication model is like pulling teeth with an ice skate. – jlo-gmail Jan 18 '17 at 02:19