MS Graph API GET Group members only get users - microsoft-graph-api

Currently i have a request for getting the members of a group. But can someone help my composing a request that only show objects of type microsoft.graph.user so i don't have groups in my group members request?
The current request:
https://graph.microsoft.com/v1.0/groups/GROUPID/members?$select=id,displayName,givenName,mail,surname,userPrincipalName

The standard way to achieve your requirement would be to apply type case such as https://graph.microsoft.com/v1.0/groups/GROUPID/members/microsoft.graph.user?$select=id,displayName,givenName,mail,surname,userPrincipalName. There is currently a bug that fails the above query. Please use query like https://graph.microsoft.com/beta/groups/GROUPID/members/microsoft.graph.user in the meantime as a workaround. Notice the changes in version from v1.0 to beta and the lack of $select. We will soon fix the bug to get the former query working.

Related

List channels of a team including FilesFolder relationship

I want to use the 'List channels' API call to list all channels belonging to a team and also retrieve the 'filesFolder' relationship in a single request. I'm using the code below with the dot net SDK and v1.0 API endpoint.
await graphClient.Teams[team.Id].Channels.Request().Expand("filesFolder").GetAsync();
When this code executes, it causes an exception: "Microsoft.Graph.ServiceException: 'Message: The query specified in the URI is not valid. Query option 'Expand' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",
but the help states that the $expand parameter is supported: https://learn.microsoft.com/en-us/graph/api/channel-list?view=graph-rest-1.0&tabs=http .
I'd like to use the $expand parameter to potentially avoid many extra calls. Is this a bug? Am I doing something wrong?
So I forgot about this question and I eventually contacted Microsoft Support directly. They informed me that the List Channels API method does not support the $expand parameter and that there are no plans to add support for it and that the help page would be corrected. Looks like the help page still hasn't been corrected yet.

Microsoft graph API: /me/drive/root/search - can't add filters to query

I'm trying to make search request for my OneDrive files with some specific extensions. Only solution I've got right now is to filter out after received response but that's not what I'm looking for.
Query I tried:
https://graph.microsoft.com/v1.0/me/drive/root/search(q='book filetype:xlsx OR filetype:xls OR filetype:svg OR filetype:json OR filetype:txt')
Unfortunately it's not returning anything.
AFAIK, the search endpoint will search the keyword like 'book' with all the extensions and give the driveItem objects as response. You need to filter it on your end which extension you like to pick by writing the code. Please raise a feature request in Microsoft Graph Feedback Forum so that the Product team may implement it in future.

Microsoft Graph API - Expanding versions for recently accessed files gives error

I'm using this endpoint of the Microsoft Graph API to get files recently accessed by a user. Versions is a relationship of the response type, as per this link.
However, when I try to add an expand param to include versions as well, I get an error.
This is the query:
https://graph.microsoft.com/v1.0/me/drive/recent?$expand=versions
And I get a generalException response with this error message:
An unspecified error has occurred.
What am I doing wrong? Please help!
I was also able to reproduce your issue as you said. But as a work around you can use the same GET https://graph.microsoft.com/v1.0/me/drive/recent and get the recent driveItem objects and pull the driveItem Ids individually and make requests individually. You can use either one of the below calls.
You can get the data with other properties of the driveItem.
https://graph.microsoft.com/v1.0/me/drive/items/01252UHI5DGSKWGHIUXBD3GPQWY7UT7TVN?$expand=versions
If you want to get only versions you can use the below query.
https://graph.microsoft.com/v1.0/me/drive/items/01252UHI5DGSKWGHIUXBD3GPQWY7UT7TVN/versions

Microsoft Graph: reportRoot: getMailboxUsageDetail. Filter on lastActivityDate property?

My use case is to get all mailboxes which are not being used actively. So that we can take appropriate action like removing O365 license and free up licenses.
For this, I am using the graph API getMailboxUsageDetail
I am trying to filter out based on lastActivityDate property but not getting expected result. I have 2 questions on this.
Is this the correct way to find all not actively used mailboxes? If not, please let me know what is the correct way?
If yes, is this filter property supported?

Microsoft Graph missing attribute [duplicate]

This question already has an answer here:
Where is facsimileTelephoneNumber for User in Microsoft Graph?
(1 answer)
Closed 5 years ago.
I'm using Microsoft Graph API to query for user data. I've succesfully obtained access token and simple queries such as https://graph.microsoft.com/beta/me work just fine.
The problem is that the query's response is missing attributes such as fax which is very important for me. Using the old https://graph.windows.net endpoint returns facsimileTelephoneNumber attribute (which is the same) but I cannot use this older endpoint.
I've tried following https://github.com/microsoftgraph/microsoft-graph-docs/issues/2151 answer (3rd message) but I can't get the extensions working and I don't even know if it would have any help to this problem.
So is it possible to access fax attribute using the newer Microsoft Graph API?
The GitHub answer you linked to was in regards to a personal contact, not users in the Active Directory. So to save you some frustration, that isn't the way forward :).
When you query for /me, you're getting the user's entry from Active Directory. This is a user resource in Graph. From the reference, the user resource has no property that exposes a fax number. Just to make sure the docs weren't incorrect, I checked the metadata exposed by the service (GET https://graph.microsoft.com/beta/$metadata), and there is no fax field on a user.
There's a request on UserVoice (https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/18166054-microsoft-graph-api-user-fax-number) already to add this, you may want to go vote that up.
The Graph doesn't expose all of these fields.
try using https://developer.microsoft.com/en-us/graph/docs/concepts/query_parameters
I think in your case this will work
https://graph.microsoft.com/v1.0/me?$select=fax
If you want more properties of the user resource you can add them as comma separated values after the select query parameter.

Resources