• RSS
  • Twitter
  • FaceBook

Exchange Server Forums

Forums | Register | Login | My Profile | Inbox | RSS RSS icon | My Subscription | My Forums | Address Book | Member List | Search | FAQ | Ticket List | Log Out

Programmatically set permissions on Public Folders

Users viewing this topic: none

Logged in as: Guest
  Printable Version
All Forums >> [Microsoft Exchange 2003] >> Public Folders >> Programmatically set permissions on Public Folders Page: [1]
Login
Message << Older Topic   Newer Topic >>
Programmatically set permissions on Public Folders - 9.May2005 5:36:00 PM   
steni31

 

Posts: 6
Joined: 4.Apr.2005
From: Skanderborg
Status: offline
Hi,

Does anyone have som script samples for setting permissions on public folders. Preferably in VB or using WebDAV, have been looking round the Internet but haven't found anything.

Stefan Nielsen
Post #: 1
RE: Programmatically set permissions on Public Folders - 31.May2005 6:36:00 PM   
sandeepk1999

 

Posts: 2
Joined: 31.May2005
From: US
Status: offline
I'm also looking for a way to set permission on Public folders programmatically. Did you find a solution? Can anybody help.

Thanks
Sandeep

(in reply to steni31)
Post #: 2
RE: Programmatically set permissions on Public Folders - 1.Jun.2005 11:12:00 AM   
sandeepk1999

 

Posts: 2
Joined: 31.May2005
From: US
Status: offline
I have this code working, this function can run from a client machine having outlook.

Private Sub SetFolderPermission(Server As String, AliasUser As String, FolderName As String, OwnerName As String)
On Error GoTo ErrHandler
'Input : Server - Name of the Exchange Server
' AliasUser - User name used to login as
' FolderName - Name of the folder for which the permission needs to be set
' OwnerName - User Name for whom the permission needs to be set
'This function is used to set permission on a public folder
' "Public Fodlers\Projects\FolderName"

Dim Session As MAPI.Session
Dim store
Dim root As MAPI.Folders
Dim fldr As MAPI.Folders
Dim fldritm
Dim acls
Dim fldr_aces
Dim gal
Dim member
Dim newace

Set Session = CreateObject("MAPI.Session")

Session.Logon "", "", False, False, True, True, Server & vbLf & AliasUser

' get a folder here
Set store = Session.InfoStores.Item("Public Folders")
Set root = Session.GetFolder(store.Fields(&H66310102), store.ID).Folders
Set fldr = root.Item("Projects").Folders
Set fldritm = fldr.Item(FolderName)

' get the aclsobject for the folder
Set acls = CreateObject("MSExchange.aclobject")
Set acls.cdoitem = fldritm ' set the CDO folder to CDOItem
Set fldr_aces = acls.aces ' get ACEs for folder

' create a new ace and add member
Set newace = CreateObject("MSExchange.ACE")

' fetch the GAL
Set gal = Session.AddressLists("Global Address List")
Set member = gal.AddressEntries.Item(OwnerName)

newace.ID = member.ID

'Use the appropriate permission you want to set
' RoleOwner = &H5e3
' RolePublishEditor = &H4e3
' RoleEditor = &H463
' RolePublishAuthor = &H49b
' RoleAuthor = &H41b
' RoleNoneditingAuthor = &H413
' RoleReviewer = &H401
' RoleContributor = &H402
' RoleNone = &H400
'
' RightsEditOwn = &H8
' RightsEditAll = &H20
' RightsDeleteOwn = &H10
' RightsDeleteAll = &H40
' RightsReadItems = &H1
' RightsCreateItems = &H2
' RightsCreateSubfolders = &H80
' RightsFolderOwner = &H100
' RightsFolderContact = &H200
' RightsFolderVisible = &H400
' RightsNone = 0
newace.rights = &H5E3 ' role owner

fldr_aces.Add newace ' add the ACE to the collection
' Internally the newace.id has been
' converted to the long term value.
' newace.id is now different than
' member.id above

'fldr_aces.Delete newace.ID ' then delete it
' note the use of the id property
' the ID is the long-term entry id

acls.Update ' commit changes to store
CleanUp:
Set store = Nothing
Set root = Nothing
Set fldr = Nothing
Set fldritm = Nothing
Set acls = Nothing
Set fldr_aces = Nothing
Set gal = Nothing
Set member = Nothing
Set newace = Nothing
Set Session = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Number & " - " & Error
Resume CleanUp
End Sub

(in reply to steni31)
Post #: 3
RE: Programmatically set permissions on Public Folders - 15.Jun.2005 5:56:00 AM   
tranthanhhakg

 

Posts: 1
Joined: 24.May2005
From: Viet Nam
Status: offline
I'm also looking for a way to set permission on Public folders(in Exchange 2003) programmatically.

Did you find a solution?

Can anybody help.

(in reply to steni31)
Post #: 4

Page:   [1] << Older Topic    Newer Topic >>
All Forums >> [Microsoft Exchange 2003] >> Public Folders >> Programmatically set permissions on Public Folders Page: [1]
Jump to:

New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Follow TechGenix on Twitter