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

How to create event where current user not organizer using Microsoft Graph API(如何使用 Microsoft Graph API 创建当前用户不是组织者的事件)
本文介绍了如何使用 Microsoft Graph API 创建当前用户不是组织者的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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/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);

事件已创建,但无论 IsOrganizer=false 且 Organizer 设置为与创建事件的用户不同的用户 (johndoe@some.com) 响应始终显示 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 (johndoe@some.com) 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 创建当前用户不是组织者的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)