locked
How to impersonate using Exchange Web Service API for specific actions RRS feed

  • Question

  • Hi,

    I have a service account SvcAcc to manage contacts (add/update/delete contacts) for all the exchange users. I Impersonate using the below cmdlet to manage contacts but it also allows SvcAcc to perform other functions (send email etc) on behalf of the user. 

    cmdlet

    New-ManagementRoleAssignment -Name:impersonationAssignmentName -Role:ApplicationImpersonation -User:serviceAccount

     

    //impersonation code

       service.Credentials = new NetworkCredential(ServiceAccountUserName, ServiceAccountPassword, domain);
       service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, userEmail);

     

    please suggest how can i impersonate for only Contacts

    Tuesday, April 13, 2010 8:08 AM

Answers

  • That part of the documentation actually has code samples written with auto-generated proxies.

    This part shows how to manipulate delegates with the EWS Managed API. To access another user's folder as a delegate, simply specify that user's mailbox in the folder Id:

    FolderId inboxOfAnotherUser = new FolderId(WellKnownFolderName.Inbox, "anotheruser@contoso.com");

    David Claux | Program Manager - Exchange Web Services
    • Marked as answer by tepu Wednesday, April 14, 2010 8:02 AM
    Wednesday, April 14, 2010 4:26 AM

All replies

  • Exchange Impersonation is an "all or nothing" model. An account that has impersonation rights can do everything as if it were the user it impersonates.

    If you want more granularity, you may want to use delegate access instead.


    David Claux | Program Manager - Exchange Web Services
    Tuesday, April 13, 2010 5:12 PM
  • thanx, can you plz guide me to use delegation for the desired functionlity
    Tuesday, April 13, 2010 8:14 PM
  • it will be great id you could provide me example code or something
    Tuesday, April 13, 2010 8:56 PM
  • Please check out the documentation.
    David Claux | Program Manager - Exchange Web Services
    Wednesday, April 14, 2010 4:23 AM
  • That part of the documentation actually has code samples written with auto-generated proxies.

    This part shows how to manipulate delegates with the EWS Managed API. To access another user's folder as a delegate, simply specify that user's mailbox in the folder Id:

    FolderId inboxOfAnotherUser = new FolderId(WellKnownFolderName.Inbox, "anotheruser@contoso.com");

    David Claux | Program Manager - Exchange Web Services
    • Marked as answer by tepu Wednesday, April 14, 2010 8:02 AM
    Wednesday, April 14, 2010 4:26 AM