How can I filter or sort classes when listing them via the Graph for Education API

Martin Plante 0 Reputation points
2024-11-15T16:32:33.1133333+00:00

When calling the List Classes endpoint for a school that is part of a district, the API returns thousands of classes, old and new, in no particular order.

We need to either filter that list or sort it by descending order of "last updated" or "created" date, or any other way to get classes for a single school or a term. I did not find any property on a Class object to work with, and none of our customers seem to be using the "Term" property. Or maybe this property is not returned by default when listing classes?

For some customers, we manage to filter by startsWith on the displayName, ExternalId or externalName, but this is only possible when the school uses scripts to generate classes.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,514 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,403 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nivedipa-MSFT 3,121 Reputation points Microsoft Vendor
    2024-11-22T10:26:37.1966667+00:00

    @Martin Plante - We got received an updates from engineering team saying thatthe createdDateTime property of the group isn't shown in the List Classes API, and you can only sort by displayName.
    The term should be returned by default if it's been set by SDS(School Data Sync).

    As old courses build up, it gets hard to find current courses via the API. That's why SDS lets you 'Mark group expired' at the end of a term, adding 'EXT' to the group/class name for easy filtering.
    Ref Doc: https://learn.microsoft.com/en-us/schooldatasync/azure-ad-group-cleanup

    Thanks, 

    Nivedipa

    ************************************************************************* 

    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here )to escalate. 


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.