使用Xamarin和Microsoft Graph在Sharepoint中创建项目

时间:2016-11-01 09:25:04

标签: sharepoint xamarin office365api microsoft-graph

有人可以向我解释如何使用SharepointMicrosoft Graph中创建项目吗?

我使用了这个repro IgniteBrk3114

使用

获取Infos
var response = await client.GetStringAsync("https://graph.microsoft.com/beta/sharepoint/site/drive/items/root/children?$select=name");

我现在能以同样的方式推出PostAsync吗?

var postResult = await client.PostAsync("https://graph.microsoft.com/beta/sharepoint/site/drive/items/root/children", contents);

或者这是错误的方式?我需要更改SharePointClient()吗? 我也看到了这个Add Collaboration To Your Mobile Apps with SharePoint,但它现在不起作用。

1 个答案:

答案 0 :(得分:0)

您似乎正在尝试在SharePoint根网站的文档库中创建文件。如果那是您尝试做的事情,那么您的语法会有所不同:

var requestUrl = "https://graph.microsoft.com/beta/sharePoint/site/drive/root/children/filename.txt/content";
var requestData = new StreamContent(fileStream) // HttpContent with file contents
var response = await client.PutAsyc(requestUrl, requestData);

SharePoint / OneDrive for Business不支持POST到子集合。