简体   繁体   English

在Exchange服务器日历上以没有模拟(EWS)的其他用户身份创建约会

[英]Creating appointment on Exchange server calendar as other user without impersonation (EWS)

I am creating simple app for appointments scheduling and I want to implement ability for me to create appointments for my users. 我正在创建用于约会计划的简单应用程序,我想为我实现为用户创建约会的功能。

I managed to create,update and delete my calendar on Exchange Server, and I somewhat managed to create appointments adding my colleagues as RequiredAttendees like so: 我设法在Exchange Server上创建,更新和删除日历,并且在某种程度上设法创建了将同事添加为RequiredAttendees的约会,如下所示:

//service variable is being created using my credidentals
Appointment meeting = new Appointment(service);
meeting.Subject = "Some subject ";
meeting.Body = "Some body.";
meeting.Start = DateTime.Now;
meeting.End = meeting.Start.AddHours(4);
meeting.Location = "Some Location";
meeting.RequiredAttendees.Add("myCollegue@mail.com");

meeting.ReminderMinutesBeforeStart = 60;
meeting.Save(new FolderId(WellKnownFolderName.Calendar,
    "myCollegue@mail.com"),
    SendInvitationsMode.SendToAllAndSaveCopy);

But it is just setting him as required attendee. 但这只是将他设置为必需的与会者。 Next thing is I tried using impersonation, but I can't access hosting server to set myself as master and others to have to share calendar with me (due to permissions and stuff) so I had to scrape that as well. 接下来的事情是我尝试使用模拟,但是由于权限和其他原因,我无法访问托管服务器将自己设置为主人,而其他人则不得不与我共享日历,因此我也不得不将其删除。 Also, he set me up to be his publishing author on his calendar. 另外,他还让我成为他的日历上的出版作者。 Is there something I am missing, or can't seem to find on MSDN sites? 我缺少什么,或者似乎在MSDN站点上找不到吗?

EDIT: I am able to create appointment in his calendar in outlok. 编辑:我可以在他的日历中创建约会。

If anyone comes across same issues as I did in here please follow these steps: 如果有人遇到与我在此处遇到的相同问题,请按照以下步骤操作:

  1. Make sure that person for which you are creating appointment sets you up (on exchange server or in outlok as "Editing author" with all permissions. 确保您要为其创建约会的人(在交换服务器上或在外行中以“编辑作者”的身份拥有所有权限)对您进行设置。

  2. After that you can create appointments for him (verify this by going to your outlok and creating some test appointments). 此后,您可以为他创建约会(通过外出并创建一些测试约会来进行验证)。

This code works for me: 该代码对我有用:

Folder inboxFolder = Folder.Bind(service, new FolderId(WellKnownFolderName.Calendar, "your.colleague@company.com"));
Appointment appointmentOther = new Appointment(service);
appointmentOther.Subject = "Test 2";
appointmentOther.Body = "Body text";
appointmentOther.Start = DateTime.Now;
appointmentOther.End = DateTime.Today.AddHours(16);
appointmentOther.Location = "My Office";
appointmentOther.IsReminderSet = true;
appointmentOther.ReminderMinutesBeforeStart = 30;
appointmentOther.Save(inboxFolder.Id,SendInvitationsMode.SendToNone);

Good luck :) 祝好运 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM