首页 > 解决方案 > 使用 MS Graph API 恢复日历事件而不向与会者发送通知

问题描述

我需要通过 MS Graph API 从用户日历中恢复事件,而不向与会者发送通知。问题在于,创建活动时,它会自动向所有与会者发送一封电子邮件,无论是旧活动还是新活动。我只想创建活动而不发送任何电子邮件。我还尝试添加 ResponseRequested=false 和 responseStatus=None 属性,但它什么也不做。
我找不到任何选项来控制它。创建事件应包含一个布尔值,以启用“向与会者发送通知”选项,如果其为 false,则它不会向与会者发送日历邀请,否则将发送。

这是请求的示例:

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var @event = new Event
{
    Subject = "Let's go for lunch",
    Body = new ItemBody
    {
        ContentType = BodyType.Html,
        Content = "Does mid month work for you?"
    },
    Start = new DateTimeTimeZone
    {
        DateTime = "2019-03-15T12:00:00",
        TimeZone = "Pacific Standard Time"
    },
    End = new DateTimeTimeZone
    {
        DateTime = "2019-03-15T14:00:00",
        TimeZone = "Pacific Standard Time"
    },
    Location = new Location
    {
        DisplayName = "Harry's Bar"
    },
    Attendees = new List<Attendee>()
    {
        new Attendee
        {
            EmailAddress = new EmailAddress
            {
                Address = "adelev@contoso.onmicrosoft.com",
                Name = "Adele Vance"
            },
            Type = AttendeeType.Required
        }
    }
};

await graphClient.Me.Calendars["AAMkAGViNDU7zAAAAAGtlAAA="].Events
    .Request()
    .AddAsync(@event);

https://docs.microsoft.com/en-us/graph/api/calendar-post-events?view=graph-rest-1.0&tabs=csharp

标签: office365microsoft-graph-apioutlook-restapi

解决方案


推荐阅读