This sample shows you how to use the Exchange Web Services EWS Managed API to Add delegate users to an email account programmatically.
The following method AddCalendarEditDelegate accepts an instance of the ExchangeService class to connect to the Exchange Web Service, primary email account and a delegate email address.
In This method we add the delegateEmailAddress as delegate to the primary email account that will receives calendar requests and has permission to edit the primary email account’s calendar.
To start using EWS Managed API, see this article: http://dotnet-practice.com/utiliser-exchange-web-service-ews-managed-api/
static void AddCalendarEditDelegate(ExchangeService service, Mailbox primaryMailbox, string delegateEmailAddress)
//Create the delegate instance
DelegateUser calendarDelegate = new DelegateUser(delegateEmailAddress);
//Enable delegate Email address to receive meeting requests
calendarDelegate.ReceiveCopiesOfMeetingMessages = true;
calendarDelegate.Permissions.CalendarFolderPermissionLevel = DelegateFolderPermissionLevel.Editor;
service.AddDelegates(primaryMailbox, MeetingRequestsDeliveryScope.DelegatesAndMe, calendarDelegate);