I am having a difficult time creating a sharing link with Microsoft.Graph API that is blocking downloads and share the link with external pears.
I managed to create a link which is blocking users from downloading the shared files, however, whenever I try to grant access to this link to external pears I am getting an exception telling me that "One or more users could not be resolved".
Has anybody got a hint for me what I may be doing wrong?
My code is
Permission linkresult = driveItemRequestBuilder.CreateLink("blocksDownload", "users", null, null, null).Request().PostAsync().Result;
string base64Value = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(linkresult.Link.WebUrl));
string encodedUrl = "u!" + base64Value.TrimEnd('=').Replace('/', '_').Replace('+', '-');
So far this seems to work but once I want to grant access to the link with this code
IPermissionGrantCollectionPage grantedPermissions = this.GraphClient.Shares[encodedUrl].Permission.Grant(roles, recipients).Request().PostAsync().Result;
I am getting the exception:
Code: invalidRequest Message: One or more users could not be resolved
