這是我的答案。使用API調用更簡單。
public HttpResponseMessage ExchangeCalendar()
{
string itemId = string.Empty;
string subscriptionId = string.Empty;
string pushResponse = "OK";
string RESPONSE_OK = string.Empty;
HttpContent requestContent = Request.Content;
string eventData = requestContent.ReadAsStringAsync().Result;
XmlDocument doc = new XmlDocument();
doc.LoadXml(eventData);
subscriptionId = GetNodeValue(doc.GetElementsByTagName("t:SubscriptionId"));
itemId = GetNodeValue(doc.GetElementsByTagName("t:ItemId"));
calendarId = GetNodeValue(doc.GetElementsByTagName("t:FolderId"));
RESPONSE_OK = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope\"><soap:Body><SendNotificationResult xmlns=\"http://schemas.microsoft.com/exchange/services/2006/messages\"><SubscriptionStatus>" + pushResponse + "</SubscriptionStatus></SendNotificationResult></soap:Body></soap:Envelope>";
return new HttpResponseMessage()
{
Content = new StringContent(RESPONSE_OK, Encoding.UTF8, "text/xml")
};
}
謝謝pjneary。但我的問題是,我如何從該通知中獲取值。當日歷發生變化時,ews api會打電話給我的網址。現在在哪些變量中這些值是。我正在使用C#代碼,我也檢查request.header,但也沒有信息..請幫助 –
請回復。我被卡住了。等待c#代碼 –