Creating resource mailboxes
The following code sample creates a room mailbox object in the specified organizational unit. Note how you need to create a mailbox object first, and set its Exchange properties later.
- ADSI
-
Import-Module Adaxes # Connect to the Adaxes service. $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the organizational unit. $parent = $service.OpenObject("Adaxes://OU=Resources,DC=example,DC=com", $null, $null, 0) # Create a new room mailbox object. $room = $parent.Create("adm-RoomMailbox", "CN=Conference Room A") $room.Put("mail", "conf-room-a@example.com") $room.Put("mailNickname", "conf-room-a") $room.SetInfo() # Create an instance of mailbox parameters. $mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeResourceMailboxParameters" $mailboxParams.ResourceCapacity = 12 # Apply mailbox parameters to the mailbox object. $room.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE") - PowerShell
-
Import-Module Adaxes $parentDN = "OU=Resources,DC=example,DC=com" $domain = "example.com" $attributes = @{ "displayName" = "Conference Room A" "mailNickname" = "conf-room-a" "mail" = "conf-room-a@example.com" "msExchResourceCapacity" = 12 } New-AdmObject -Type "adm-RoomMailbox" ` -Name "Conference Room A" ` -Path $parentDN ` -OtherAttributes $attributes ` -AdaxesService localhost -Server $domain
The following code sample creates an equipment mailbox object in the specified organizational unit.
- ADSI
-
Import-Module Adaxes # Connect to the Adaxes service. $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the organizational unit. $parent = $service.OpenObject("Adaxes://OU=Resources,DC=example,DC=com", $null, $null, 0) # Create a new equipment mailbox object. $equipment = $parent.Create("adm-EquipmentMailbox", "CN=Projector 01") $equipment.Put("mail", "projector-01@example.com") $equipment.Put("mailNickname", "projector-01") $equipment.SetInfo() # Create an instance of mailbox parameters. $mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeResourceMailboxParameters" $mailboxParams.BookingWindowInDays = 3 # Apply mailbox parameters to the mailbox object. $equipment.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE") - PowerShell
-
Import-Module Adaxes $parentDN = "OU=Resources,DC=example,DC=com" $domain = "example.com" $attributes = @{ "displayName" = "Projector 01" "mailNickname" = "projector-01" "mail" = "projector-01@example.com" } New-AdmObject -Type "adm-EquipmentMailbox" ` -Name "Projector 01" ` -Path $parentDN ` -OtherAttributes $attributes ` -AdaxesService localhost -Server $domain
See also
- Writing ADSI scripts
- Server-side scripting
- IAdmExchangeResourceMailboxParameters
- IADsContainer
- Online script repository