OneDriveAPI icon indicating copy to clipboard operation
OneDriveAPI copied to clipboard

[BUG] OneDriveGraphApi.ShareItem with Organization scope does not work as expected

Open DemiDOS opened this issue 2 years ago • 2 comments

Description I get the message Access Denied for my corporate account in browser when I use the link generated by the API method OneDriveGraphApi.ShareItem with Organization scope.

To Reproduce Steps to reproduce the behavior:

  1. Upload a file and generate link to file using API: var oneDriveGraphApi = new OneDriveGraphApi(_oneDriveApiInfo.ClientId); await oneDriveGraphApi.AuthenticateUsingRefreshToken(_oneDriveApiInfo.RefreshToken); var oneDriveFile = await oneDriveGraphApi.UploadFileToAppFolder(filePath); var oneDrivePermission = await oneDriveGraphApi.ShareItem(oneDriveFile, OneDriveLinkType.View, OneDriveSharingScope.Organization);
  2. Check the file on OneDrive. The file was uploaded and shared via link, but the link does not work.
  3. If anonymous access is disabled in organization, there is an issue with access to file via link.

Expected behavior Uploaded file should be accessible via link for everyone inside organization.

Versions:

  • OS: Windows 10
  • OneDriveApi: 2.4.0
  • .NET 6.0

DemiDOS avatar Sep 19 '23 15:09 DemiDOS

Quick look into problem: request (https://graph.microsoft.com/v1.0/me/drive/items/***/createLink) contains empty body. I guess, serialization of OneDriveRequestShare instance always create empty string and does not respect provided values.

DemiDOS avatar Sep 19 '23 16:09 DemiDOS