c# graph sdk events of a group are null even with expand

Bryan Dellinger 1 Reputation point
2022-08-26T17:45:40.623+00:00

I am attempting to get the events for a single office 365 group.
using graph explorer I am successful with

https://graph.microsoft.com/v1.0/groups/88d59881-7b15-4adc-a756-5d10681cf99d/events

but the events are always null when I try to perform the same query in the sdk. it appears that expand does not work. I get the id, display name and description of the group but the events collection is null

public static Task<Group> GetGroup()
{
EnsureGraphForAppOnlyAuth();
// Ensure client isn't null
_ = _appClient ??
throw new System.NullReferenceException("Graph has not been initialized for app-only auth");

    return _appClient.Groups["88d59881-7b15-4adc-a756-5d10681cf99d"]    
        .Request()    
         .Expand(m => m.Events)    
        .Select(u => new    
        {    
            // Only request specific properties    
            u.DisplayName,    
            u.Id,    
            u.Description,     
            u.Events    
        })    
        .GetAsync();    
}    
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,446 questions
0 comments No comments
{count} votes