Exchange web service set organizer of the appointment

微笑、不失礼 提交于 2019-12-13 02:24:04

问题


When I use Service account to add a new appointment, the organizer always the user of Credentials to Exchange service, I want to set the organizer to another user, but the organizer property is readonly, how can I achieve that?

           var appointment = new Appointment(_service.ExchangeService);
            
            if (exchangeAppointment.Participants.Any() && exchangeAppointment.Participants != null)
            {
                foreach (var participant in exchangeAppointment.Participants)
                {
                    appointment.RequiredAttendees.Add(participant);
                }
            }
            appointment.Resources.Add(exchangeAppointment.RoomAdIdentityEmail);
            appointment.Location = string.Join(",", appointment.Resources);
            appointment.Subject = exchangeAppointment.Subject;
            appointment.Body = exchangeAppointment.Body;
            appointment.Start = exchangeAppointment.StartTime;
            appointment.End = exchangeAppointment.EndTime;
            appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

回答1:


The Organizer is going to be set based on the Calendar your saving the Appointment to, when you using a Service Account your creating the Appointment OnBehalf of the Organizer so you would need set the Save location to the calendar of the Organizer you want eg

Save(new FolderId(WellKnownFolderName.Calendar, "user@ddomain.com"), SendInvitationsMode.SendToAllAndSaveCopy);

The other option is to use EWS Impersonation and then Impersonate the Organizer http://msdn.microsoft.com/en-us/library/office/dd633680%28v=exchg.80%29.aspx

Cheers Glen



来源:https://stackoverflow.com/questions/27255240/exchange-web-service-set-organizer-of-the-appointment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!