Microsoft图形SingleValueLegacyExtendedProperty请求返回空GUID

时间:2018-02-13 10:14:02

标签: c# microsoft-graph mapi

我提出了使用Graph-SDK从日历中的所有事件中获取特定单值属性的请求。为实现这一点,我根据Graph API文档(https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/singlevaluelegacyextendedproperty_get)使用了一个过滤器。我使用的过滤器是“id eq”布尔值{00062002-0000-0000-C000-000000000046} Id 0x8223'“。以下是我用于此请求的代码。

public static async Task<Tuple<List<Event>, List<ICalendarEventsCollectionRequest>>> GetEventsSingleValuePropertyAsync(GraphServiceClient graphClient, String userId, String calendarId, String filterQuery, int top, String select)
    {
        List<ICalendarEventsCollectionRequest> requestList = new List<ICalendarEventsCollectionRequest>();
        // filterQuery =  "id eq 'Boolean {00062002-0000-0000-C000-000000000046} Id 0x8223'"
        String filterSingleVP = "singleValueExtendedProperties($filter=" + filterQuery + ")";
        List<Event> eventList = new List<Event>();
        ICalendarEventsCollectionPage result = null;
        ICalendarEventsCollectionRequest request = null;

        if (calendarId == "")
            request = graphClient.Users[userId].Calendar.Events.Request().Expand(filterSingleVP).Top(top).Select(select);
        else
            request = graphClient.Users[userId].Calendars[calendarId].Events.Request().Expand(filterSingleVP).Top(top).Select(select);
        try
        {
            if (request != null)
            {
                result = await request.GetAsync();
                requestList.Add(request);
                eventList.AddRange(result);
            }
            if (result != null)
            {
                var nextPage = result;
                while (nextPage.NextPageRequest != null)
                {
                    var nextPageRequest = nextPage.NextPageRequest;
                    nextPage = await nextPageRequest.GetAsync();
                    if (nextPage != null)
                    {
                        requestList.Add(nextPageRequest);
                        eventList.AddRange(nextPage);
                    }
                }
            }
        }
        catch
        {
            throw;
        }

        return new Tuple<List<Event>, List<ICalendarEventsCollectionRequest>>(eventList, requestList);
    }

我获取所有事件,并且使用SingleValueLegacyExtendedProperty扩展与查询匹配的每个事件。唯一困扰我的是它看起来像这样:

"singleValueExtendedProperties":
    [
        {
            "value":"true",
            "id":"Boolean {00000000-0000-0000-0000-000000000000} Id 0x8223"
        }
    ],

正如您所见,该值已存在,但ID现在具有空GUID。 我测试了一些其他属性,但我总是得到相同的结果。 我以为我的过滤器会将给定的“filterQuery”与答案中的“id”进行比较。

我是否误解了某些内容或我的请求实施是否错误?

1 个答案:

答案 0 :(得分:2)

这看起来就像我们这边的一个错误。好像Guid道具可能没有正确设置或序列化。我会把它提交给团队 - 感谢你的报告。

CNC中  是的,事实上我们已经有了一个解决方案,应该在几天内检查。

-edit,edit- 仅仅为了教育,它的行为方式就是你使用的GUID是“众所周知的指南”之一。在这种情况下,我们的代码在内部设置着名的GUID字段而不是普通的propertySetId guid字段,REST在呈现响应时始终使用propertySetId。当然,如果propertySetId是Guid.Empty,那么我们当然要使用众所周知的guid字段。

-edit,编辑,编辑 - 为此检查了修复程序并将开始正常部署。它应该会在几周内达到WW饱和度。