我很高兴在自己的租户中读写文件。将文件写入另一个用户共享的文件夹时,我使用:
GraphServiceClient graphClient = GetAuthenticatedClient(accessToken);
UploadSession uploadSession = await graphClient.Shares[encURL].Site.Drive.Root.ItemWithPath($@"/testshare/test.txt").CreateUploadSession().Request().PostAsync();
其中encURL是加密的共享URL。
但是,当我尝试访问其他租户中的文件夹时,创建uploadSession会出现以下异常:Code: invalidRequest Message: The site in the encoded share URI is invalid.
。
当尝试使用RestSharp列出其他租户中的共享文件夹的内容时,我也会遇到相同的错误(这也适用于同一租户内部共享的文件夹)。该应用程序注册设置为多租户,并且访问令牌具有Files.ReadWrite.All和Sites.FullControl.All权限。
是否可以使用GraphServiceClient(或任何其他方法)在与其他租户共享的文件夹中使用增量读取,写入和获取更改?非常感谢您的帮助。