问题描述
需要创建一个当前用户不是组织者的事件.我尝试使用以下用于创建事件的代码:
Need to create an event where current user is not the organizer. I tried with the following code that I'm using to create the event:
var eventsEndPoint=New Uri("https://graph.microsoft.com/v1.0/users/[email protected]/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':'[email protected]'} }}";
var createBody = new StringContent(postBody, system.Text.Encoding.UTF8, "application/json");
HttpResponseMessage response = await httpClient.PostAsync(eventsEndPoint, createBody);
事件被创建,但是无论IsOrganizer = false且Organizer设置为与为其创建事件的用户不同的用户([email protected]),响应始终显示IsOrganizer设置为true且Organizer用户相同用户,而不是根据请求在Organizer属性中设置的用户.
Event gets created but no matter that IsOrganizer=false and Organizer is set to different user than the one the event is created for ([email protected]) response always show that IsOrganizer gets set to true and Organizer user is the same user and not the one set at Organizer property at the request.
是否可以使用Graph设置其他组织者?
Is it possible to set a different organizer using Graph?
推荐答案
听起来您正在尝试使用委托(也称为代表发送").目前,Graph不支持委派.您的活动将始终以经过身份验证的帐户作为组织者来创建.
It sounds like you are attempting to use delegates (aka "send on behalf of"). At the moment delegation isn't supported by Graph. Your events will always be created with the authenticated account as the organizer.
这篇关于如何使用Microsoft Graph API在当前用户不是组织者的情况下创建事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!