Reputation: 11
I am trying to implement few of EMS Cmdlets function using C# with out using Powershell commands. How can i achieve following commands functionality in C# using EWS Managed API 2.0.
Grant FullAccess
add-mailboxpermission 'userID-1' -accessrights fullaccess -user 'userID-2'
Grant SendOnBehalfOf
get-mailbox 'userID-1' | foreach { $_.GrantSendOnBehalfTo += (Get-Mailbox 'userID-2').Identity; $_ } | Set-Mailbox
Grant SendAs
get-mailbox 'userID-1' | add-ADPermission -User 'userID-2' -extendedrights 'Send As'
Thanks
Upvotes: 0
Views: 1210
Reputation: 22032
You can't EWS is a Mailbox Access API and what your trying to do is an Administrative task so you need to use the Exchange Management Shell. You can invoke the cmdlets in your managed code using something like https://msdn.microsoft.com/en-us/library/office/jj943721(v=exchg.150).aspx. The only thing you can do in EWS in regards to permission is set permission at the Mailbox Folder level (eg Inbox,Calendar etc).
Cheers Glen
Upvotes: 1