Teams Graph API, Retrieving files from each Teams channel - microsoft-graph-api

I am trying to retrieve all of the files associated with each channel within each Team. Per the Microsoft Graph REST API V1.0 documentation, it is GET /teams/{id}/channels/{id}/filesFolder.\
Please see https://learn.microsoft.com/en-us/graph/api/channel-get-filesfolder?view=graph-rest-1.0&tabs=http
However, filesFolder no longer appears as an available query. Is there still a way to achieve this?
Edit: Appears to be the same for Messages. https://learn.microsoft.com/en-us/graph/api/channel-list-messages?view=graph-rest-beta&tabs=csharp&viewFallbackFrom=graph-rest-1.0
Why are these queries no longer available?

You can query Groups with team-id to get the items from the group's drive directly.
You can use https://graph.microsoft.com/v1.0/groups/{team-id}/drive/root/children where /drive/root can get the Document library that the channel folders are part of and /children can display all items from the folder. Referto this doc for more details on how to get a DriveItem.

Related

Is there any way to get the list of joined teams details of members?

Is there any way to get the list of joined teams details of members except graph API? Using graph API of below link we can get the list of joined teams details of any members. Similarly, is there any other way to get the list of joined MS teams group details? I want to use these details in Microsoft bot framework.
https://learn.microsoft.com/en-us/graph/api/user-list-joinedteams?view=graph-rest-1.0&tabs=csharp
Due to some security concern I can not use graph API as of now.
I am also exploring below link but I am not getting anything here... Looking for any REST API like graph API where I can provide the users name and I can get details.
https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/get-teams-context?tabs=dotnet
It's not a security concern, rather it's part of the requirement. If i am in your place, i would set Graph API as prerequisite for my app to work, explain the benefits that you're going to get with Graph/application permissions. Apart from Microsoft Graph API you can try with Powershell, CLI.

Is there a rest call to get the item id for a document on SharePoint online or on drive?

I need to obtain the document's information uploaded on SharePoint online. But I cannot use item id as it's not possible to keep a track of pre- uploaded documents.
Is there a rest call that can give the list of all the documents
Present on a drive/folder on SharePoint online or one drive?
Is there a rest call to get the item id for a document on SharePoint
online or on drive?
For this issue , you can retrieve the metadata for a DriveItem in a Drive by file system path or ID. For details please refer to this document.
Is there a rest call that can give the list of all the documents
Present on a drive/folder on SharePoint online or one drive?
For this issue,you have the below api to get all the files inside a folder. For details, please refer to this case.
<YouDomainServer>/_api/Web/GetFolderByServerRelativeUrl(<relativepath>)/Files
In addition ,you can also use Graph API to get user's one drive data in SharePoint. You can refer to this blog and case to get help.

Search sharePoint for specific contentType with MsGraph

I need to get sharePoint sites which contain specific type of items.
As I see on this docs
https://learn.microsoft.com/en-us/graph/query-parameters
searching is only supported for messages and persons, so I would need to know up-front in which sites and lists to look for the items of the given type or use the sharePoint api not the msGraph.
Am I correct or there is some other way?
For the files, you can use /search endpoint to perform search in the OneDrive and inside SharePoint/Group document libraries. Per documentation, you can use one of the following:
GET /drives/{drive-id}/root/search(q='{search-text}')
GET /groups/{group-id}/drive/root/search(q='{search-text}')
GET /me/drive/root/search(q='{search-text}')
GET /me/drive/search(q='{search-text}')
GET /sites/{site-id}/drive/root/search(q='{search-text}')
GET /users/{user-id}/drive/root/search(q='{search-text}')
For example, to retrieve all Excel files in user's OneDrive, you would perform such request:
GET /me/drive/root/search(q='.xlsx')
More info: https://learn.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0

Graph API - Get recent files from a particular site collection

I'm trying to fetch recent files from SharePoint Online using Microsoft Graph.
The API I'm using is :
https://graph.microsoft.com/v1.0/me/drive/recent
But the results include files from all site collection. I need to restrict the results to only a single site collection.
After some research, I found that there is no direct API to restrict the site collection.
I also tried using adding filter like :
$filter=sharepointIds/siteId eq 'site-id'
but it was also not working. It gave a `501 (Not implemented) error.
Update:
I found another API from Graph which is
https://graph.microsoft.com/beta/me/insights/used
which is inside insights(beta) named "items viewed and modified by me"
But it again returns data across tenant and I need to restrict it to a single site collection. I guess filter conditions are not yet implemented for this API in Graph.
Is there any method to get recent files from a particular site collection? Any help is appreciated.
One correction, /me/drive/recent isn't pulling from all site collections, it's pulling from the current user's OneDrive. This includes recent files held within their drive and any recent changes to files that have been shared with them.
As for finding Recent Files from a SharePoint Document Library, you need to make this request within the context of the drive you want to pull from. For example:
https://graph.microsoft.com/v1.0/sites/root/drives/{documentLibraryId}/recent

How to get Organisation Directory list from Microsoft Graph

Is there a way we can get Directory of all users? me/people gives relevant users which is not a complete list of users. We need to access complete list of users for searching.
The /users endpoint seems to be what you're looking for. Documentation is at https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_list
For example, a call to GET https://graph.microsoft.com/v1.0/users should return a paged list of all users in the tenant.
I also recommend you take a look at the Graph explorer that has samples for querying this endpoint. You can view these by clicking the show more samples link.

Resources