0

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.

  • 1
    Basically it comes from the api doesn't support to using $filter, so you got error on it. Because the api document didn't mention it, so I can't provide any evidence on it. – Tiny Wang Jan 19 '22 at 06:28
  • I was hoping that wasn't the case... Seems hit and miss for a random assortment of endpoints in graph. – WadeTheFade Jan 19 '22 at 14:25

1 Answers1

1

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}");
  • This is mostly the correct answer. The filtering by title isn't supported, but what causes the query to return a badly formatted 404 response is a bug (e.g. it should fail more gracefully with a helpful message instead). The code in this answer would functionally achieve the same result as filtering. Also, we're looking at improving the experience around filtering and clarifying what filters are available across all endpoints. – Tarkan Sevilmis Jan 19 '22 at 20:36
  • Thanks for the heads up. If that is the case, I'd also like to add also occurred using the Beta API. – WadeTheFade Jan 20 '22 at 14:20