Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using EWS Managed API to create appointments for other users?

In EWS Managed API is it easy to create an appointment for a specific user:

ExchangeService service = new ExchangeService();
service.Credentials = new NetworkCredentials ( "administrator", "password", "domain" );
service.AutodiscoverUrl(emailAddress);

Appointment appointment = new Appointment(service);
appointment.Subject = "Testing";
appointment.Start = DateTime.Now;
appointment.End = appointment.Start.AddHours(1);
appointment.Save();

This will create a appointment for the administrator. But say I wanted to actually create an appointment for another user (not add that user as an attendee to me appointment). It this possible via the EWS Managed API?

like image 251
Kyle Avatar asked Mar 10 '10 18:03

Kyle


People also ask

What is EWS Managed API?

Exchange Web Services (EWS) is an application program interface (API) that allows programmers to access Microsoft Exchange items such as calendars, contacts and email.

What is Exchange EWS used for?

Exchange Web Services (EWS) is a cross-platform API that enables applications to access mailbox items such as email messages, meetings, and contacts from Exchange Online, Exchange Online as part of Office 365, or on-premises versions of Exchange starting with Exchange Server 2007.

What is EWS client?

EWS is a comprehensive service that your applications can use to access almost all the information stored in an Exchange Online, Exchange Online as part of Office 365, or Exchange on-premises mailbox.


2 Answers

Folder inboxFolder = Folder.Bind(service, new FolderId(WellKnownFolderName.Inbox, "[email protected]"));

Will work too. Then pass inboxFolder.id to the Appointment.Save call. The updates and deletes don't need this. The best answer is to use impersonate, but this requires it to be enabled by the server admins. If you don't wield such power, this method will let you do what you need. Note: the user running your application must have permissions on the target account or this will fail (as it should).

Found here: http://msdn.microsoft.com/en-us/library/gg274408(v=EXCHG.80).aspx

like image 89
matt Avatar answered Oct 02 '22 12:10

matt


I figured it out from this article: http://msdn.microsoft.com/en-us/library/dd633680(EXCHG.80).aspx

You should use the service.ImpersonatedUserId attribute.

like image 31
Kyle Avatar answered Oct 02 '22 13:10

Kyle