|
-
How can you set public folder client permissions using code under exchange 2000?
I have been able to figure out how to set the directory rights of a public
folder using code under exchange 2000, but have been unable to do so with
the client permissions.
=========================================================
code for setting directory rights if you are interested
=========================================================
Sub GrantAccessToPublicFolder(ByVal strUserAlias As String, ByVal strFolderName
As String)
Const FULL_CONTROL = -1
Const ADS_ACETYPE_ACCESS_ALLOWED = 0
Const ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT = 2
Dim adsObject As IADs
Dim adsSecDesc As IADsSecurityDescriptor
Dim adsDACL As IADsAccessControlList
Dim adsNewACE As New AccessControlEntry
Dim USER_DN As String 'Distinguished Name
Dim FOLDER_DN As String 'Distinguished Name
USER_DN = NT_SERVER_NAME & "\" & strUserAlias
FOLDER_DN = "LDAP://" & EXCHANGE_SERVER_NAME & "/CN=" & strFolderName
& ",CN=Microsoft Exchange System Objects,DC=" & EXCHANGE_SERVER_NAME & ",DC="
& EXCHANGE_SERVER_DOMAIN & ",DC=" & EXCHANGE_SERVER_DOMAIN_ROOT
'Create an ace for the person you wish to grant access to the public
folder
adsNewACE.Trustee = USER_DN
adsNewACE.AccessMask = FULL_CONTROL
adsNewACE.AceType = ADS_ACETYPE_ACCESS_ALLOWED
adsNewACE.AceFlags = ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT
'Get the adsobject for the folder
Set adsObject = GetObject(FOLDER_DN)
'Get the security descriptor for the public folder directory object
Set adsSecDesc = adsObject.Get("nTSecurityDescriptor")
'Get the existing descretionary DACL
Set adsDACL = adsSecDesc.DiscretionaryAcl
'Add the new ace to the DACL
Call adsDACL.AddAce(adsNewACE)
'Update the security descriptor with the updated descretionary DACL
adsSecDesc.DiscretionaryAcl = adsDACL
'replace the security descriptor for the public folder
adsObject.Put "nTSecurityDescriptor", Array(adsSecDesc)
'Write out the property cache to update the changes
adsObject.SetInfo
Set adsDACL = Nothing
Set adsSecDesc = Nothing
Set adsNewACE = Nothing
Set adsObject = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks