C# Android:从另一个应用程序打开日历中的特定事件
我目前正在Xamarin.Android上开发一个应用程序,其中一个功能是,单击按钮后,用户将进入Microsoft Outlook应用程序中的特定日历事件。到目前为止,我一直在使用Microsoft Graph API获取事件项,并且我成功地将Outlook应用程序打开到日历或打开Outlook,并显示一条错误消息“无法打开事件”,但我没有实现这两种行为,也没有打开特定的事件项。我打开Outlook应用程序的方式是使用Outlook uri方案调用设备的默认浏览器。下文提供了这两种情况C# Android:从另一个应用程序打开日历中的特定事件,c#,android,xamarin,xamarin.android,microsoft-graph-api,C#,Android,Xamarin,Xamarin.android,Microsoft Graph Api,我目前正在Xamarin.Android上开发一个应用程序,其中一个功能是,单击按钮后,用户将进入Microsoft Outlook应用程序中的特定日历事件。到目前为止,我一直在使用Microsoft Graph API获取事件项,并且我成功地将Outlook应用程序打开到日历或打开Outlook,并显示一条错误消息“无法打开事件”,但我没有实现这两种行为,也没有打开特定的事件项。我打开Outlook应用程序的方式是使用Outlook uri方案调用设备的默认浏览器。下文提供了这两种情况 bro
browserLaunch("ms-outlook://events/open?account={my.account@email.com}&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": "my.account@email.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "string",
"address": "my.account@email.com"
}
}
我还尝试了graphs API为restid参数提供的不同ID。到目前为止,我已经使用了webLink字段的url中的itemid参数、json对象的id、changeKey和iCalUId,但最后两个参数除了打开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"
您希望将嵌入上述url中的{webLinkItemId}字符串插入上述方案中的相应位置嘿!我不太明白你有什么问题,你想做什么。你能解释一下第一段吗?“我目前……提供如下”?因此该功能是这样的:应用程序调用microsoft graph api获取用户的事件,然后在列表视图中显示每个事件。然后,每个列表项对应于用户outlook日历上的一个事件。我要做的是为每个列表视图项提供一个按钮,当按下该按钮时,您将进入列表视图项所代表的outlook日历事件的详细信息活动。我已获得打开outlook应用程序到日历的按钮,或者打开时出现错误,但无法获得打开outlook日历事件详细信息的按钮确定谢谢。您是想在outlook应用程序中打开的详细信息,还是您自己的应用程序?您使用什么文档来获取AppLink?你也试过这些吗?我想在outlook中打开详细信息页面,是的,我试过大约一百种不同的“ms”变体-outlook://events/open?restid=%s&account=test@我的应用程序中的“om.com”没有运气。然而,使用该方案,我确实收到一条消息说“事件无法打开”,所以我尝试了一系列不同的事件ID。我没有尝试过不可变id,因为graph api没有为我的api调用提供任何“事件无法打开”似乎是最正确的。你有没有确保公开,也许你没有正确的访问权限?还有,当你收到这个消息时,你的模式是什么?