I am trying to get all users in an office location using Microsoft Graph
I am receiving the following error message:
Unsupported or invalid query filter clause specified for property 'officeLocation' of resource 'User'.
I am using the following uri and filter:
https://graph.microsoft.com/v1.0/users?$filter=officeLocation eq '18/2107'
at the graph explorer here:
https://developer.microsoft.com/en-us/graph/graph-explorer
How can I pull all users for an Office Location?
Thanks!
The Microsoft Graph API is a RESTful web API that enables you to access Microsoft Cloud service resources. After you register your app and get authentication tokens for a user or service, you can make requests to the Microsoft Graph API.
Microsoft Graph is also more secure and resilient than Azure AD Graph. For this reason, Azure AD Graph has been on a deprecation path since June 30, 2020, and will be retired in the near future as we move all investments to Microsoft Graph.
Graph Explorer is a developer tool that lets you conveniently make Microsoft Graph REST API requests and view corresponding responses. Use Graph Explorer to try APIs on the default sample tenant to explore capabilities, or sign in to your own tenant and use it as a prototyping tool to fulfill your app scenarios.
The Microsoft Graph API supports accessing data in users' primary mailboxes and in shared mailboxes. The data can be calendar, mail, or personal contacts stored in a mailbox in the cloud on Exchange Online as part of Microsoft 365, or on Exchange on-premises in a hybrid deployment.
Unfortunately this property on user is not filterable. If this is something important, please file a request for this on Uservoice: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/category/101632-microsoft-graph-o365-rest-apis
Hope this helps,
Filter on officeLocation is not available till date, we can query for all user than can filter out from that based on officeLocation, API will not return all user in one call, Microsoft Graph will continue to return a reference to the next page of data in the @odata:nextLink property with each response until all pages of the result have been read.You can retrieve the next page of results by sending the URL value of the @odata:nextLink property to Microsoft Graph.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With