Ho to filter based on the expanded object count

Melvin Fengels 0 Reputation points
2023-06-30T09:27:36.9333333+00:00

When sending the following query:

https://graph.microsoft.com/v1.0/education/users/58cb7e2a-0342-46d4-9a55-73f903e4297c/assignments?$expand=submissions($filter=status eq 'submitted';$count=true)

It correctly returns on the submitted assignments.
How can I filter out assignments that don't have any submissions?

What I tried

Filtering the submissions count with the following:

https://graph.microsoft.com/v1.0/education/users/58cb7e2a-0342-46d4-9a55-73f903e4297c/assignments?$expand=submissions($filter=status eq 'submitted';$count=true)&$filter=submissions/$count($filter=status eq 'submitted') eq 1

This is not supported.
Directly filtering the submissions:

https://graph.microsoft.com/v1.0/education/users/58cb7e2a-0342-46d4-9a55-73f903e4297c/assignments?$expand=submissions($filter=status eq 'submitted';$count=true)&$filter=submissions/any(s:s/status eq 'submitted')

Sadly this is also not supported.
I also tried to filter based on the submissions@odata.count property, but I didn't find any way to access this property

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,798 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. TH-4749-MSFT 3,305 Reputation points
    2023-07-03T19:41:28.1566667+00:00

    Hello Melvin Fengels,

    Thanks for reaching out. The $filter or $search within count clause are not supported.". I would suggest voicing your query and feedback on the Graph Feedback Forum.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    Thanks.


  2. mona ahmed mostafa 10 Reputation points
    2023-07-04T16:02:36.3466667+00:00

    ممكن نتعرف على الرسالة التي لا تحمل الواجبات من الخارج فنحدد الرسائل ونحذفها

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.