The next code segment uses an if statement to check if an
error message has been stored in the variable $err by New-PublicFolder . This will be the case only if
there was a problem creating the folder.
If so the if statement displays the error message stored in $err , then exits the script. The error messages
generated by New-PublicFolder are sufficient to use in this case to tell the administrator there was a
problem creating the folder.
Part IV: Automating Administration
462
If ($err -ne $null) { $err; exit }
If the folder was created successfully, then the next code segment sends the contents of $newFolder to
the display. When the variable $newFolder is used in this way, the information displayed takes the form
of the default output from New-PublicFolder .
$newFolder
The last code segment uses Add-PublicFolderClientPermission to set the permissions for the user
on the new folder. The identity of the folder is taken from the public folder object stored in $newFolder .
The User parameter input value is taken from the user alias as derived from the mailbox object stored in
$userMB . The AccessRights parameter input value is a static value of Editor . This access right allows
the users to create and delete their own content in the folder, but does not allow them to delete the folder
or create sub - folders.
Pages:
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643