Is there any sample code exists which has code written for creating office365 rest notification service contains push subscription, using client side libraries?
This link has given info but using rest calls. Is there anything using client libraries like using Notification class or Push subscription class?
We can write like following code to create subscription, but this add method is void !!!, so you will not get response and you will not get subscription id as well.
OutlookServicesClient client = new OutlookServicesClient(new Uri("https--//outlook.office.com/api/v2.0"), async () => { // Since we have it locally from the Session, just return it here. return token; });
client.Context.SendingRequest2 += new EventHandler<Microsoft.OData.Client.SendingRequest2EventArgs>(
(sender, e) => InsertXAnchorMailboxHeader(sender, e, email));
PushSubscription subscribeme = new PushSubscription();
subscribeme.NotificationURL = "https://mywebhook.azurewebsites.net/api/send/myNotifyClient";
subscribeme.ChangeType = ChangeType.Deleted;
subscribeme.ClientState = "AJFromPushSubcribtion_" + DateTime.Now.ToString();
subscribeme.Resource = "https://outlook.office.com/api/v2.0/me/Events";
subscribeme.SubscriptionExpirationDateTime = DateTime.Now.AddDays(1);
await client.Me.Subscriptions.AddSubscriptionAsync(subscribeme);