I'm attempting to use the REST API to migrate files from our users' personal SharePoint sites (e.g. http://organization-my.sharepoint.com/personal/bob@organization.onmicrosoft.com).
The account which I've authorized is a global administrator in the system. During the OAuth flow, our app requests the AllSites.Manage and AllProfiles.Manage scopes.
I'm able to view/modify my personal site without difficulty. In order to view other users' personal sites, I have to add myself as a "site collection owner" in: SharePoint admin center
-> user profiles
-> i:0#.f|membership|user@organization.onmicrosoft.com
Doing so it rather tedious and I'd like to either automate the process, or find some way to configure my app scopes / administrative user so it's not necessary.
To that end, I've been trying to assign permissions via the roleassignments endpoints. Unfortunately, _api/web/roleassignments
consistently returns:
{"error":{"code":"-2147024891, System.UnauthorizedAccessException","message": {"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}
FullControl
permission on theTenant
?