简体   繁体   中英

Edit Exchange appointment of other user

I'm coding a service which should synchronize Outlook appointments with another system. After appointment created I need to add some info to the body. The service is running under some tech account, it's also added as an owner to the organizer's calendar in Outlook. However, the following code doesn't do any changes:

var _exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP2, TimeZoneInfo.Local)
{
    Url = new Uri(someUrl),
    Credentials = new NetworkCredential(someUser, somePwd, someDomain)
};

Appointment appointment = Appointment.Bind(_exchangeService, someId, new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End));

string oldSubject = appointment.Subject;

appointment.Subject = appointment.Subject + " moved one hour later and to the day after " + appointment.Start.DayOfWeek + "!";
appointment.Start.AddHours(25);
appointment.End.AddHours(25);

  appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendOnlyToAll);

The sample code is taken from MSDN. The code works when Organizer and tech Account is the same user.

Do you have any idea of what could be wrong? Thank you!

The sample code is taken from MSDN. The code works when Organizer and tech Account is the same user.

That's correct because you can only make changes to appointments that the user making the modifications is the owner off (in some case this will require that you use EWS Impersonation https://msdn.microsoft.com/en-us/library/office/dd633680(v=exchg.80).aspx ). For a Meeting object where you have multiple attendees once you make changes in the Organizer mailbox updates then need to be sent out to the attendees who then need to acknowledge those updates for the updates to be applied to the version of the Appointment in the attendee's calendars.

Cheers Glen

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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