Michael Hufnagel
Michael Hufnagel

Reputation: 557

Microsoft graph SingleValueLegacyExtendedProperty request returns empty GUID

I made a request to get a specific single value property from all events in a calendar with the Graph-SDK. To achieve this i used a filter according to the Graph APIs documentation (https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/singlevaluelegacyextendedproperty_get). The filter i used was " id eq 'Boolean {00062002-0000-0000-C000-000000000046} Id 0x8223' ". Below is the code i used for this request.

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);
    }

I get all events and every event that matched the query gets expanded with the SingleValueLegacyExtendedProperty. The only thing that bothers me is that it looks like this:

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

As you can see the value is present but the id now has an empty GUID. I tested some other properties but i always had the same result. I thought my filter compares the given "filterQuery" with the "id" in the answer.

Did i misunderstand something or is my request implementation just wrong?

Upvotes: 1

Views: 1154

Answers (1)

David Sterling - MSFT
David Sterling - MSFT

Reputation: 580

That just looks like a bug on our side. Seems like the Guid prop might not be getting set or serialized correctly. I will bring it up to the team - thanks for the report.

-edit- Yep, in fact we already have a fix for this that should be checked in in a few days.

-edit, edit- Just for education's sake, the reason that it behaves this way is that the GUID that you are using is one of the "well known guids". In that case, our code is setting the well-known GUID field internally instead of the normal propertySetId guid field and REST always uses the propertySetId when rendering responses. The fix of course on our side is to use the well known guid field if the propertySetId is Guid.Empty.

-edit,edit,edit- A fix was checked in for this and will begin normal rollout. It should reach WW saturation in a few weeks.

Upvotes: 3

Related Questions