Using IExchangeFolderACLs to Modify Public Folder Access

Let us see how IExchangeFolderACLs interface may be used to read and modify access control entries for a public folder. The following code fragment demonstrates reading and dumping access masks. The code assumes that MyPublicFolder exists in All Public Folders. You should either create one or change pszFolder variable accordingly.
 

Reading Contents of a Public Folder ACL

{

DELPHI CODE HERE

}

Let us see what is happening here. First, I open public message store and locate the folder ENTRYID. The I use it to obtain IExchangeFolderACLs interface. This is accomplished with help of the HrFolderACLsOpen function. Then I use its HrGet method to scan through all entries.

After I have run this code I saw that the first two entries in ACL don't have either pszDisplayName or ENTRYID. These two entries are special cases. They are reserved for the Default and Anonymous access.
 

Modifying Access Rights

Let's us see how we could modify access rights for a mailbox. The following fragment is taken from my Security/IExchangeFolderACLsModify sample. The code scans through the list to locate our test entry first. Then I set up the position with the HrSeek call and use the HrModify method.
 

{

DELPHI CODE HERE

}

You need to be a folder owner to modify rights for other accounts. This means that your own rights set should contain frightsOwner. A folder may have many owners. This is similar to Windows NT security - in order to modify permissions for other accounts you own accounts should be powerful enough, otherwise the operation fails.