无法使用 Graph API 获取事件的 OpenTypeExtensionProperty
Unable to get OpenTypeExtensionProperty for event using Graph API
对于我们的一个应用程序,我正在尝试使用 C# 中的以下代码获取事件的扩展:
var result = graphServiceClient.User[userid].Calendar.Events[eventid].Extensions.Request().GetAsync().Result;
但是,我遇到以下异常:
Code: ErrorInvalidRequest
Message: The OData request is not supported.
ClientRequestId: f7a44c2f-ca79-4f79-9726-2cdc98d87e00
我在 Whosebug 上发布的几个问题中找到了上面的代码。
我们需要通过任何方式添加和获取 opentype 扩展。有人可以帮忙吗?
首先,我使用 Microsoft Graph 资源管理器 create the event and add opentypeextension 到它:
然后 get the opentypeextensions 上面的事件使用它的 id:
代码将如下所示:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var extension = await graphClient.Me.Events["'AAMkAGRlNWYmM5YjIzNTRhMwBGAAAAAAA-AAA='"].Extensions["Com.Contoso.Referral"]
.Request()
.GetAsync();
以上对我有用,但在我的情况下,我想检查特定扩展的所有 outlook 事件,如果扩展不存在于任何一个事件中,我会收到以下错误:
Code: ErrorItemNotFound
Message: The specified object was not found in the store.
ClientRequestId: a65d0d31-123b-4834-9bec-8d471d22b6e0
为了解决上述问题,在遍历所有事件时,我在 try catch 块中添加了用于获取扩展的代码,并在 catch 块中添加了以下代码以继续循环,以防出现上述异常
if (ex.InnerException.GetType() == typeof(ServiceException) &&
ex.InnerException.Message.Contains("Code: ErrorItemNotFound"))
continue;
无论如何,我的问题现在已经解决了。感谢帮助
对于我们的一个应用程序,我正在尝试使用 C# 中的以下代码获取事件的扩展:
var result = graphServiceClient.User[userid].Calendar.Events[eventid].Extensions.Request().GetAsync().Result;
但是,我遇到以下异常:
Code: ErrorInvalidRequest Message: The OData request is not supported. ClientRequestId: f7a44c2f-ca79-4f79-9726-2cdc98d87e00
我在 Whosebug 上发布的几个问题中找到了上面的代码。
我们需要通过任何方式添加和获取 opentype 扩展。有人可以帮忙吗?
首先,我使用 Microsoft Graph 资源管理器 create the event and add opentypeextension 到它:
然后 get the opentypeextensions 上面的事件使用它的 id:
代码将如下所示:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var extension = await graphClient.Me.Events["'AAMkAGRlNWYmM5YjIzNTRhMwBGAAAAAAA-AAA='"].Extensions["Com.Contoso.Referral"]
.Request()
.GetAsync();
以上对我有用,但在我的情况下,我想检查特定扩展的所有 outlook 事件,如果扩展不存在于任何一个事件中,我会收到以下错误:
Code: ErrorItemNotFound Message: The specified object was not found in the store. ClientRequestId: a65d0d31-123b-4834-9bec-8d471d22b6e0
为了解决上述问题,在遍历所有事件时,我在 try catch 块中添加了用于获取扩展的代码,并在 catch 块中添加了以下代码以继续循环,以防出现上述异常
if (ex.InnerException.GetType() == typeof(ServiceException) &&
ex.InnerException.Message.Contains("Code: ErrorItemNotFound"))
continue;
无论如何,我的问题现在已经解决了。感谢帮助