IMAPFolderPermission object

Description

The IMAPFolderPermission represents a single permission attached to an IMAP folder.

Methods

Delete()
 Deletes the object from the database.
 
Save()
 Saves changes of the object in the database.

Properties

Account Account
 Gets the account referenced by this permission.
(read-only)
 
Group Group
 Gets the group referenced by this permission.
(read-only)
 
long ID
 The unique database identifier for the ACL permission.
(read-only)
 
bool Permission(eACLPermission iType)
 ACL permission
 
long PermissionAccountID
 The identifier of the account this ACL permission is connected to.
 
long PermissionGroupID
 The identifier of the group this ACL permission is connected to.
 
eACLPermissionType PermissionType
 The type of object this ACL permission is connected to.
 
long ShareFolderID
 The folder which has been shared (read-only)
(read-only)
 
long Value
 The ACL permission value.
 
NOTE:
ACL permission value
The ACL Permission values for the public IMAP folders is as follows
Lookup = 1
Read = 2
Keep seen flag = 4
Keep other flags = 8
Insert Mail = 16
Create Mailbox = 64
Delete Mailbox = 128
Keep deleted flag = 256
Expunge = 512
Administer = 1024

The way this works.

If you want say 'Insert mail' and 'keep deleted flag' (this allows deletion) then you would set a value of 16+ 256 = 272
If you want everything except 'delete mailbox' you would set a value of 1+2+4+8+16+64+256+512+1024 = 1887

Code below sets 'Insert mail' permissions ONLY for public IMAP folder 'Another Subfolder' to the user 'account@domain.com'.

Please note that if you want 'read' permissions for a subfolder, you will also need to provide 'read' permissions to parent folder(s).

  
 Dim oApp, oPermission, oPublicFolder
    Set oApp = CreateObject("hMailServer.Application")
    Call oApp.Authenticate("Administrator", "Secret_Password")

    'set Public Folder
    set oPublicFolder = oApp.settings.Publicfolders.ItemByName("Main Folder").subfolders.itemByName("Subfolder").subfolders.add("Another Subfolder")
    set oPermission = oPublicFolder.permissions.add()
    with oPermission
        .PermissionAccountID = oApp.Domains.ItemByName("domain.com").accounts.ItemByAddress(account@domain.com").id
        .value = 16
        .save()
    end with

  

 

Search documentation