我们正在尝试使用 Microsoft Graph rest API 实现 Web 应用程序和 SharePoint Online 之间的集成。
具体来说,我们需要将文件上传到特定 SharePoint 站点的文档库(驱动器),与当前用户默认驱动器不同。我们通过 Azure AD 获取访问令牌,可以访问所有文件。
我们可以使用任何驱动器上传文件,/v1.0/me/drive/...但当我们使用另一个驱动器时则不能。
例如:
var response = client.PutAsync(graphResourceUrl +
"/beta/sharepoint/sites/" + siteCollSiteId +
"/lists/" + listId +
"/drive/root/children/" + fileName + ":/content",
new ByteArrayContent(fileBytes)).Result;
var response = client.PutAsync(graphResourceUrl +
"/beta/drives/" + "/" + listId +
"/items/" + siteCollSiteId + "/" + fileName + ":/content",
new ByteArrayContent(fileBytes)).Result;
var response = client.PutAsync(graphResourceUrl +
"/beta/drives/" + listId + "/" + fileName + ":/content",
new ByteArrayContent(fileBytes)).Result;
Run Code Online (Sandbox Code Playgroud)
两者 …