是否存在使用客户端库为创建 office365 休息通知服务包含推送订阅而编写的代码的示例代码?
此链接已提供信息,但使用休息电话。是否有任何使用客户端库的东西,例如使用通知类或推送订阅类?
我们可以编写如下代码来创建订阅,但是这个 add 方法是无效的!!!,所以你不会得到响应,你也不会得到订阅 id。
OutlookServicesClient client = new OutlookServicesClient(new Uri("https--//outlook.office.com/api/v2.0"), async () => { // 既然我们是从Session本地获取的,就在这里返回. 返回令牌; });
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);