Sdílet prostřednictvím


Setting rights permissions on folders

Customer Scenario:
Customer called and required the ability to set rights permissions on folders and subfolders in their mailboxes using outlook.

Unfortunatly this cannot be done using the outlook object model so you would need to use exchange web services and/or Ex Managed APIs (and of course extended MAPI); but not in the outlook object model

Here some snippets via EWS Proxy classes:

Folder Permissions:

PermissionSetType permissionSet = new PermissionSetType();
permissionSet.Permissions = new PermissionType[] { new PermissionType() };
PermissionSet = folder.PermissionSet

permissionSet.Permissions[0].PermissionLevel = PermissionLevelType.Editor;
permissionSet.Permissions[0].UserId = user;

more details here:
https://msdn.microsoft.com/en-us/library/bb856574(v=EXCHG.140).aspx

and Delegates

AddDelegateType request = new AddDelegateType();

    // Identify the principal's mailbox.
    request.Mailbox = new EmailAddressType();
    request.Mailbox.EmailAddress = "user1@example.com";

    // Identify the delegates who are given access to the principal's mailbox.
    request.DelegateUsers = new DelegateUserType[2];
    request.DelegateUsers[0] = new DelegateUserType();
    request.DelegateUsers[0].UserId = new UserIdType();
    request.DelegateUsers[0].UserId.PrimarySmtpAddress = "user2@example.com";
    …

   // Specify the permissions that are granted to each delegate.
    request.DelegateUsers[0].DelegatePermissions = new DelegatePermissionsType();
    request.DelegateUsers[0].DelegatePermissions.CalendarFolderPermissionLevel = DelegateFolderPermissionLevelType.Reviewer;
    request.DelegateUsers[0].DelegatePermissions.CalendarFolderPermissionLevelSpecified = true;

    // Specify whether the principal recieves meeting requests.
    request.DeliverMeetingRequests = DeliverMeetingRequestsType.DelegatesAndSendInformationToMe;
    request.DeliverMeetingRequestsSpecified = true;

more details:
https://msdn.microsoft.com/en-us/library/bb856532(v=EXCHG.140).aspx

Comments

  • Anonymous
    April 21, 2011
    The comment has been removed