c# - 使用 O365 Graph Api 创建事件时显示日历请求
问题描述
我正在使用 Microsoft.Graph v4.9.0 nuget 包在用户日历中生成事件。该事件已成功创建并在目标用户的日历中可见,但收件箱中没有通知他已创建新事件。
目标是获得新事件的邀请,他可以接受/拒绝/标记为暂定..
调用api的代码很简单:
var newEvent = new Event() {}; //omitted, see the serialized value below
var graphResult =
await _graphServiceClient
.Users[userId]
.Calendar
.Events
.Request()
.AddAsync(newEvent);
这是 newEvent 的样子:
{
"AllowNewTimeProposals": false,
"Attendees": [{
"Type": "Required",
"EmailAddress": {
"Address": "internal_user@mycompany.com",
"Name": "internal user",
"ODataType": "microsoft.graph.emailAddress"
},
"ODataType": "microsoft.graph.attendee"
}, {
"Type": "Required",
"EmailAddress": {
"Address": "external_user@notmycompany.com",
"Name": "external user",
"ODataType": "microsoft.graph.emailAddress"
},
"ODataType": "microsoft.graph.attendee"
}
],
"Body": {
"Content": "<html>Test event</html>",
"ContentType": "Html",
"ODataType": "microsoft.graph.itemBody"
},
"End": {
"DateTime": "2021-11-09T11:00:00.0000000",
"TimeZone": "Central Europe Standard Time",
"ODataType": "microsoft.graph.dateTimeTimeZone"
},
"HasAttachments": false,
"Importance": "Normal",
"IsOnlineMeeting": false,
"IsOrganizer": false,
"IsReminderOn": false,
"Location": {
"DisplayName": "",
"ODataType": "microsoft.graph.location"
},
"Organizer": {
"EmailAddress": {
"Address": "external_user@notmycompany.com",
"Name": "external user",
"ODataType": "microsoft.graph.emailAddress"
},
"ODataType": "microsoft.graph.recipient"
},
"ReminderMinutesBeforeStart": 0,
"ResponseRequested": true,
"ShowAs": "Tentative",
"Start": {
"DateTime": "2021-11-09T10:00:00.0000000",
"TimeZone": "Central Europe Standard Time",
"ODataType": "microsoft.graph.dateTimeTimeZone"
},
"Subject": "Test event",
"Type": "SingleInstance",
"ODataType": "microsoft.graph.event"
}
活动的组织者是不属于公司的用户,因此他有一个外部电子邮件地址(例如来自 gmail)。正如我在这里读到的那样,如果组织者与我们正在为以下内容创建条目相同,则可能会出现问题:相关的stackoverflow问题
内部用户是我们正在使用的图形 api 公司的成员。(该事件是在他的日历中生成的)
他们都作为与会者添加到活动中。
然后奇怪的是,如果我将 Outlook 中日历中的事件保存为 .ics 文件,则组织者不是外部用户,而是内部用户。
ATTENDEE;CN="External user";RSVP=TRUE:external_user@notmycompany.com
ORGANIZER;CN="Internal user":mailto:internal_user@mycompany.com
我有点不知道现在要尝试在收件箱中为内部用户提供日历通知。
解决方案
推荐阅读
- api - Alexa Proactive Events API - 如何确定用户是否禁用了 Alexa 通知?
- javascript - Javascript,从值创建一个数组
- swift - 如何随着时间的推移或分数更新时增加重力?
- php - 如何从 MySQL 表条目中删除所有非数字字符
- c - 无法访问内存中的某个位置
- javascript - 在新选项卡中创建和打开 PDF
- python - 交换单词但保留两个字符串之间的其他字符
- python - 管道/流 gnupg 输出到 tarfile 中
- powershell - Zip 文件不完整或为空 - Powershell
- c# - 在 .NET Core 项目中添加参考对话框缺少程序集部分