[英]Microsoft Graph - Outlook Api - How to get the id of the event created?
我成功地創建了一個 outlook 日歷事件。
await 'clientForRequest'.Me.Calendars['calendario_id'].Events.Request().AddAsync(@event);
如果我用@event.id
event.id 獲得@event
的ID,它會給我null
。
如果我在請求(添加事件)之前使用隨機字符串基 140(我在“ @event
://developer.microsoft.com/en-us/graph/graph-explorer# " 與我創建的一些事件),事件的 ID 設置為日歷 Outlook 具有不同的 ID。
如何正確獲取使用該請求創建的事件的 ID?
await 'clientForRequest'.Me.Calendars['calendario_id'].Events.Request().AddAsync(@event);
執行您在上面編寫的代碼片段應返回所創建事件的事件 object。
因此,您可以按如下方式獲取事件 id,
Event createdEvent = await 'clientForRequest'.Me.Calendars['calendario_id'].Events.Request().AddAsync(@event);
Console.WriteLine(createdEvent.Id);
您沒有將AddAsync()
的結果分配給@event
。 您需要自己分配:
@event = await 'clientForRequest'
.Me
.Calendars['calendario_id']
.Events
.Request()
.AddAsync(@event);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.