小编dan*_*fer的帖子

使用 Microsoft Graph 将文件上传到 SharePoint 驱动器

我们正在尝试使用 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)

两者 …

sharepoint onedrive microsoft-graph-api

6
推荐指数
2
解决办法
1万
查看次数

如何使用 Microsoft Graph API 创建当前用户不是组织者的活动

需要创建当前用户不是组织者的活动。我尝试使用以下代码来创建事件:

var eventsEndPoint=New Uri("https://graph.microsoft.com/v1.0/users/johndoe@some.com/events");

var postBody="{'Subject':'Testing Organizer - 12','Location':{'DisplayName':'Some place'}," +
        "'Start': {'DateTime': '2016-07-15T15:00:00.0000000', 'TimeZone':'UTC'}," +
        "'End': {'DateTime': '2016-07-15T15:30:00.0000000', 'TimeZone':'UTC'},"+
        "'Body':{'Content': 'This is a test of Grap API.', 'ContentType':'Text'},"+
        "'IsOrganizer':'False','Organizer':{'EmailAddress': "+"{'Address':'organizer@some.com'} }}";

var createBody = new StringContent(postBody, system.Text.Encoding.UTF8, "application/json");
HttpResponseMessage response = await httpClient.PostAsync(eventsEndPoint, createBody);
Run Code Online (Sandbox Code Playgroud)

事件已创建,但无论 IsOrganizer=false 且组织者设置为与创建事件的用户 (johndoe@some.com) 不同的用户,响应始终显示 IsOrganizer 设置为 true 且组织者用户是同一用户,而不是同一用户根据要求在组织者属性中设置的一个。

是否可以使用 Graph 设置不同的组织者?

c# office365api office365-restapi microsoft-graph-api

3
推荐指数
1
解决办法
2050
查看次数