-1

This might look similar to this post, but has some unique aspects:

When I make an Api call to graph.microsoft.com/beta/users{user-id}/onenote/pages?top=5 to fetch onenote pages, I get the error "The OneDriveForBusiness for this user account cannot be retrieved"

I do have onenote files in my business-onedrive. When I use that url in the Graph Explorer to read my recent notes, I get a normal result. If I call the api from a php-file (my "APP" which i've registered in O365)and use the same URL/endpoint (with a valid Bearer token), I get the error "The OneDriveForBusiness for this user account cannot be retrieved". In azure, I've granted all permissions to the app.

The weird thing is: my app does work for 5 minutes when I first use the graph explorer and then afterwards run my app. It somehow must be an authorization issue, but what can it be?!

RTC
  • 3
  • 2

1 Answers1

0

You need to call the onenote/notebooks or onenote/pages endpoint to fetch OneNote entities instead of the calendars/id/events.

cs95
  • 379,657
  • 97
  • 704
  • 746
Manjusha
  • 538
  • 2
  • 4
  • Oh stupid me: the api-url in my question was not the right one. the one I actually use is "https://graph.microsoft.com/beta/users/{user-id}/onenote/pages?top=5". I've edited my initial question on this point. the complete response headers are: [code] => 30108 [message] => OneDrive for Business for this user account cannot be retrieved. [request-id] => 3b64442b-89c1-4a41-a73f-b90536320181 [date] => 2019-03-20T12:47:40 – RTC Mar 20 '19 at 12:53