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

时间:2016-06-29 08:39:53

标签: c# exchange-server exchangewebservices ews-managed-api

我正在为约会安排创建简单的应用程序,我想实现为我的用户创建约会的能力。

我设法在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);

但这只是将他作为必要的参与者。接下来的事情是我尝试使用模拟,但我无法访问托管服务器将自己设置为主人和其他人必须与我共享日历(由于权限和东西)所以我不得不刮掉它。此外,他让我成为他日历上的出版作家。 是否有我遗漏的东西,或者似乎无法在MSDN网站上找到?

编辑:我可以在他的日历中创建约会。

1 个答案:

答案 0 :(得分:5)

如果有人遇到与此处相同的问题,请按以下步骤操作:

  1. 确保您正在为其创建约会的人员(在Exchange服务器上或outlok中为“编辑作者”设置了所有权限。

  2. 之后,您可以为他创建约会(通过转到您的outlok并创建一些测试约会来验证这一点。)

  3. 此代码适用于我:

    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);
    
    祝你好运:)