我当前正在使用Xamarin.Android中的应用程序,其功能之一是,单击按钮后,用户将被带到Microsoft Outlook应用程序中的特定日历事件。到目前为止,我一直在使用Microsoft Graph API获取事件项,并且成功打开了日历中的Outlook应用程序或打开了Outlook,并显示错误消息“无法打开事件”,但我没有得到既会发生行为,也不会打开特定事件。我打开Outlook应用程序的方式是通过使用Outlook uri方案调用设备的默认浏览器。两者都在下面提供
browserLaunch("ms-outlook://events/open?account={[email protected]}&restid={id}");
private async void browserLaunch( string uri ) {
await Browser.OpenAsync(uri, BrowserLaunchMode.SystemPreferred);
}
我一直在对Graphs API进行的确切调用如下
https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2020-01-23T15:54:40.377Z&enddatetime=2020-01-30T15:54:40.377Z
使用以下方案返回偶数项列表:
"@odata.etag": "string",
"id": "string",
"createdDateTime": "20##-##-##T##:##:##.######Z",
"lastModifiedDateTime": "20##-##-##T#3:##:##.#######Z",
"changeKey": "string",
"categories": [],
"originalStartTimeZone": "Central Standard Time",
"originalEndTimeZone": "Central Standard Time",
"iCalUId": "string",
"reminderMinutesBeforeStart": int,
"isReminderOn": true/false,
"hasAttachments": true/false,
"subject": "string",
"bodyPreview": "string",
"importance": "string",
"sensitivity": "string",
"isAllDay": true/false,
"isCancelled": true/false,
"isOrganizer": true/true,
"responseRequested": true/false,
"seriesMasterId": null,
"showAs": "string",
"type": "string",
"webLink": "https://outlook.office365.com/owa/?itemid={id}&exvsurl={int}&path=/calendar/item",
"onlineMeetingUrl": null,
"recurrence": null,
"responseStatus": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "html",
"content": "string"
},
"start": {
"dateTime": "20##-##-##T##:##:##.#######",
"timeZone": "UTC"
},
"end": {
"dateTime": "20##-##-##T##:##:##.#######",
"timeZone": "UTC"
},
"location": {
"displayName": "string",
"locationType": "string",
"uniqueId": "string",
"uniqueIdType": "stirng"
},
"locations": [
{
"displayName": "string",
"locationType": "string",
"uniqueId": "hexstrin-hexs-hexs-hexs-hexstringhex",
"uniqueIdType": "string"
}
],
"attendees": [
{
"type": "string",
"status": {
"response": "string",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "string",
"address": "[email protected]"
}
}
],
"organizer": {
"emailAddress": {
"name": "string",
"address": "[email protected]"
}
}
我还尝试了由图形API为restid参数提供的不同ID。到目前为止,我已经使用了在webLink字段的url,json对象的id,changeKey和iCalUId中找到的itemid参数,但最后两个没有给我带来任何好处,而不仅仅是打开Outlook。
我也刚刚通过了webLink,但它只是打开了一个轻量级的浏览器(并停留在白页上),我不需要,因为我特别需要它才能进入Outlook应用程序。有任何想法吗?
因此,我能够找到的最佳最新解决方案是使用不同于任何以前的url方案打开轻量级浏览器:
https://outlook.office365.com/calendar/item/{webLinkItemId}
其中,webLinkItemId是从返回的Graphs API json对象获取的webLink url中的itemId参数。您可以在我的原始文章中找到上面的完整对象,但是您在该对象中寻找的是以下字段
"webLink": "https://outlook.office365.com/owa/?itemid={webLinkItemId}&exvsurl={int}&path=/calendar/item"
您想要将{webLinkItemId}字符串嵌入上面的url中,并将其插入上述方案中的相应位置
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句