Enumerating objects and resources
To enumerate objects (or resources) of any type, call Get-CGraph command with resource type as a parameter:
Get-CGraph users
Get-CGraph groups
To enumerate objects using beta endpoint, add -Beta parameter:
Get-CGraph users -Beta
To read specific properties, list them in -Properties (or -Select) parameter:
Get-CGraph users -Properties Department
To apply a filter to a result set, specify a filter in -Filter parameter or -ODataFilter. The -Filter parameter accepts filter string in a form, similar to AD cmdlets -Filter parameter, see details in the about_ActiveDirectory_Filter article. The -ODataFilter parameter accepts filter string in OData format, as described in the "Filter parameter" section of the "Use query parameters to customize responses" article.
Get-CGraph groups -Filter 'GroupTypes -eq "Unified"'
Get-CGraph groups -beta -ODataFilter "resourceProvisioningOptions/Any(x:x eq 'Team')"
Tip: Not all Office 365 resources support all query parameters. In those cases, command execution would report a corresponding error. Please, refer to the Microsoft Graph documentation for query limitations.
Enumerating related objects or resources
Most of the objects or resources in Graph have related objects. For example, a user has related activities, calendars, groups he is a member of, owned devices or objects, and so on. See the Relationships section in the Microsoft Graph > User documentation article.
You can enumerate related resources using one of two methods: providing -Parent parameter, or piping Get-CGraph command, that returns a parent object, to a Get-CGraph command, enumerates related objects.
Get-CGraph ownedObjects -Parent "users/andy@cayosoft.com"
Get-CGraph users -ID andy@cayosoft.com | Get-CGraph ownedObjects
Comments
0 comments
Please sign in to leave a comment.