Microsoft Graph often returns a 504 Server Error: Gateway Timeout after ~30 seconds when trying to search for a OneNote Page having links/oneNoteClientUrl/href ending with a specific string.
Here is the type of query I'm making:
https://graph.microsoft.com/v1.0/sites/SHAREPOINT_SITE_ID/onenote/pages?$top=1&select=id&$filter=endswith(links/oneNoteClientUrl/href,'ONE_NOTE_PAGE_ID_FROM_ONENOTE_APP%26end')
I have to do this kind of search as my application takes as an input the link to a OneNote page from the OneNote client application.
The only way I found to find the page's id is to search for the url inside links/oneNoteClientUrl/href of a OneNote page record.
But this looks like not optimal as Microsoft Graph often times out.
Then is there any way to:
optimize this query
find the real OneNote page ID from a copied link from the OneNote app with a different query.
Related
When I load pages via
https://graph.microsoft.com/v1.0/me/onenote/sections/{ID}/pages?$top=100&$orderby=createdDateTime%20desc
the results are not up-to-date, even though changes have been synced across other devices.
There should be 4 pages in the section. This is what is in the response:
two existing pages (two are missing)
several other pages that were previously deleted, but when I try to fetch the HTML contents, I get a 404. The pages were deleted via DELETE https://graph.microsoft.com/v1.0/me/onenote/pages/{ID} per the docs
Does it work via the OneNote API?
Per #codeye's suggestion (see comments), I'm trying to access the pages via the one note API. It seems unclear whether this is still possible:
The API is deprecated and scheduled to sunset November 2022.
The docs refer to registering the application in the Microsoft account Developer Center, which appears to be obsolete and points back to the Azure portal
Later in the same doc, they refer to permissions like office.onenote_update that no longer seem to exist i.e. I can't find them in the Azure Portal. I do see permissions with the same name from two places: Microsoft Graph and OneNote - perhaps the permissions have been renamed?
However, after adding One Note ->
Notes.ReadWrite, logging out and reauthenticating, I'm still getting HTTP errors on onenote.com URLs like:
401 from https://www.onenote.com/api/v1.0/me/notes/sections/{ID}/pages?$top=100&$orderby=createdDateTime%20desc (as #codeye suggested below, tried with and without query parameters)
401 from https://www.onenote.com/api/v1.0/notebooks (URL from the docs
404 from https://www.onenote.com/api/v1.0/me/notebooks (same URL as previous, but with me/ segment added
My MS Graph API is not giving the response nowadays if I pass ?env=WebView as a query string in my intranet page which is developed with SPFX. It is working fine without giving me any problem for the last year. For the last 3 to 4 weeks this problem has started.
If I remove the query string and run the page, then it gives me the response from Graph, but along with the query string, it is not giving me the response.
Am using this graph to get my Outlook Calendar Events, Unread Mail count, and Recent Files from Drive.
Kindly help me to solve this issue.
Thanks in Advance.
MS Graph Explorer - query for OneDrive Business Account is failing
-More info found on the following github issue:
https://github.com/OneDrive/onedrive-api-docs/issues/1099
-Contacted Office 365 support who referred me here. Microsoft support case: 15301860
MS Graph explorer query:
https://graph.microsoft.com/v1.0/drives/b!a-oNn_Mnm02gMc86rSUI27vOcAGlo8BAhT7CxagLgF2oTC6OgbRmSaXoOirrlVDs/items/01ICHZFV56Y2GOVW7725BZO354PWSELRRZ
Expected Behavior:
The item query should return objects.
Actual Behavior:
OneDrive responds with a 404 error - when it should return with valid data that exists.
When Graph makes a call to SharePoint to fulfill a /v1.0/drives request it hits the tenant host, where as it will hit the personal site host for /v1.0/me/drive. As a result of this, the /v1.0/drives scenario can fail if the tenant's root site is inaccessible which looks like what you're seeing.
I will mention that we're investigating improving this experience, so hopefully in the future you won't hit a failure for this scenario.
I am trying to retrieve the list of entries that can be seen in the Windows 10 timeline view via the User Activities API in Microsoft Graph.
I have selected the UserActivity.ReadWrite.CreatedByApp permission and am getting an HTTP 200 Success response, but the value returned is empty. I am signed in with a Work Account (O365)
https://graph.microsoft.com/beta/me/activities/recent?$top=5
When I look in the timeline view in Windows 10, I see a comprehensive history of activity. The machine is signed in using the same Work Account.
Any help greatly appreciated.
According to the documentation, only activities created by the current AppID will be returned:
The UserActivity.ReadWrite.CreatedByApp permission will also apply extra filtering to the response, so that only activities created by your application are returned. This server-side filtering might result in empty pages if the user is particularly active and other applications have created more recent activities. To get your application's activities, use the nextLink property to paginate.
I'd suggest dropping the $top parameter and following the nextLink URIs to see if your app's activities show up deeper down the stack.
I have a use case where I need to poll the OneNote API approximately every minute in order to respond to text added to pages by the user.
(Aside: I'd LOVE to use webhooks to get notifications only when something changes, but that's only supported for consumer notebooks at this time, as far as I can tell.)
Polling with this frequency works for a few users (5 or so), but then, with more users who authorized the same Microsoft application, the app seems to hit an application-level rate limit and begins receiving 429 Too Many Requests responses.
How can I ensure polling will still work as the number of users grows? And are there any rate limits that can be made public or shared in confidence for valid use cases?
So it is possible to register for webhooks on the sharepoint notebooks as onedrive items - as a notebook page gets updated the notificationUrl fires and you can then using delta calls to determine which sections (section.one files) have been updated.
I would then use the onenote-api to get the pages in the updated notebook sections GET https://www.onenote.com/api/v1.0/me/notes/sections/{id}/pages
An alternative would be to treat the sharepoint drive as a webdav server and use the propfind method with the getlastmodified property to poll the drive determine which sections of various notebooks have been updated.
But I agree it would be easier if onenote webhooks were extended to sharepoint.