microsoft-graph-apimicrosoft-graph-sdksmicrosoft-graph-groups

Groups Planner Plan 404's when adding a Filter


I'm trying to pull back a specific plan through Graph API C#. I am aware that Application permissions isn't supported and I believe I am using a Delegated work flow.

This is the query I am using:

 var template = await _graphServiceClient.Groups[$"{group[0].Id}"].Planner.Plans
                    .Request()
                    .Filter($"Title eq '[Template] {templateName}'")
                    .GetAsync();

and it throws a 404 back with (truncated for readability):

    {
        "error": {
            "code": "UnknownError",
            "message": "... <fieldset>  <h2>404 - File or directory not found.</h2>  
    <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3> </fieldset> ...",
           
        }
    }

However, if I remove the FILTER line, the request goes through and I get a full list of Planner Plans that group has access to.

 var template = await _graphServiceClient.Groups[$"{group[0].Id}"].Planner.Plans
                    .Request()
                    .GetAsync();

Using the Graph Explorer I can replicate the issue.


Solution

  • On the assumption if Filter is not explicitly mentioned in of any Microsoft Graph documentation that Filter would not be supported for that endpoint, my workaround for this particular endpoint would be:

    var templates = await _graphServiceClient.Groups[$"{group[0].Id}"].Planner.Plans
                        .Request()
                        .GetAsync();
    
    
    var template = templates.Single(x => x.Title == $"[Template] {templateName}");