I have a scenario where userA shares a file with userB on OneDrive for Business. They both belong to the same Office365 tenant.
Is there a way to programmatically retrieve shared file content using userB identity (OAuth access token)? I've tried using 2.0 API syntaxt, which works for userA, but I'm getting 401 error when trying to execute this request with userB access token, even though file was shared with userB.
https://{tenantid}-my.sharepoint.com/_api/v2.0/drives/{driveId}/items/{itemId}/
Or maybe there is a way I could use Azure AD Application delegated permission to access this file on behalf of its owner having driveId and itemId?