How often is "/me/drive/recent" refreshed? - microsoft-graph-api

I am using a Microsoft Graph query: "/v1.0/me/drive/recent". It returns a set of documents as expected BUT:
More than 24 hours ago, I did the following:
I deleted a SharePoint site. The recent query is still returning results from the deleted SharePoint site.
I added documents to a MS Teams SharePoint site. Those documents are not being returned.
How often is "/v1.0/me/drive/recent" query updated?

Related

How do MS-graph OneNote page IDs map to OneNote app link page IDs?

In the MS Graph API the page IDs are in a form like this:
0-27696e96063a344f89a7735214aaa999!1-A0AC2C4AD3AAA999!34000
The second part is the MS Graph section ID.
However OneNote page links (e.g. online, or copied from the app) use UUIDs as page IDs.
How can I get the MS Graph ID from the UUID - is there some mapping? The use case is to grab a page ID from the OneNote app then immediately fetch that page from the MS Graph.
Alternatively, if there is some MS Graph query method that lets me pass information I can get from the OneNote app (e.g. Page and Section UUID) that would work fine.
This question was posed (and answered) by Velojet and Jorge Aguirre here
Basically if you get the url of a personal OneNote page https://onedrive.live.com/...|<page-id>/) Then use this approach in the MS Graph query method
GET ~/pages?$filter=contains(links/oneNoteClientUrl/href,'<page-id>')

Teams Graph API, Retrieving files from each Teams channel

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.

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

nextLink with List Children on SharePoint

I'm using the List Children of a driveItem endpoint as described https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_list_children to list the contents of folders and using the nextLink property where appropriate. This works really well with OneDrive but when listing the driveItems inside a SharePoint site I get the first 200 items and a next link which just returns the last 2 and no further nextLink. I've also tried manually setting a $top value but this didn't help.
Not sure whether this a bug with the API but any assistance would be much appreciated.
According to your descriptions, I assume you want to use the API 'https://graph.microsoft.com/v1.0/sites/{site-id}/lists'.
Based on my test, when we list all the websites by TOP query, the ‘NextURL’ will not exist in the response, if there are less than 400 websites.
Do your SharePoint site collect have more than 400 SharePoint sites? If not, how many site do you have ?

Find most recently added file into SharePoint online library

My requirement is to search for a file in my entire SharePoint Online (SPO) using Graph apis. I have my query something like this which I use in MS Graph Explorer:
https://'my domain'.sharepoint.com/_api/search/query?Querytext='res1a2b3c4d5e'
Basically above query is to search for all the documents having title/name as 'res1a2b3c4d5e'. This works fine if I search for any existing document. If I try to search for any document which was created/uploaded just before making above call I wont get the result.
If I search for the same after couple of minutes, then the request succeeds. Where as when I try the same on my customers site where it has millions of documents. It nearly takes around 20+ hours before I can do a successful search
So does graph api work on any SPO cache?
How can I search for newly added file without having to wait for 20+ hours?
Thanks in advance.
The search results will be available only after the search content is crawled and available in search index. While you can control the crawl schedule in SharePoint On-Premise, you cannot do so in SharePoint online. Crawling frequency in SharePoint online is managed by Microsoft.
More Details

Resources