Recipe9.8.Mail-Enabling or Mail-Disabling a Public Folder


Recipe 9.8. Mail-Enabling or Mail-Disabling a Public Folder

Problem

You want to mail-enable or mail-disable a public folder.

Solution

Using a graphical user interface

  1. Launch the Exchange System Manager (Exchange System Manager.msc).

  2. In the left pane, expand the appropriate Administrative Groups container.

  3. Expand the Folders node.

  4. Right-click the target folder and select All Tasks and either Mail Enable or Mail Disable.

If you want the public folder to be able to receive mail sent from the Internet directly to its SMTP address, you have some additional work to do:

  1. Right-click the target folder and select Properties.

  2. Click the Permissions tab, then click the Client permissions button.

  3. Verify that the Anonymous user has Contributor permission. If not, use the Add button to grant that permission. Click OK to dismiss the Client Permissions dialog.

  4. Click OK to close the properties dialog.

Using VBScript
' This code toggles the mail-enabled status of the selected folder. ' ------ SCRIPT CONFIGURATION ------  strComputerName = "<serverName>"     ' e.g., "cyclone"  strPubFolderPath = "<folderPath>"     ' e.g., "/Some Folder/"     ' ------ END CONFIGURATION ---------   strE2K3WMIQuery = "winmgmts://" & strComputerName &_     "/root/MicrosoftExchangeV2"      ' query for the specific folder we want   Set wmiService = GetObject(strE2K3WMIQuery)   query = "Select * From Exchange_PublicFolder" & " Where Path='" & _           strPubFolderPath & "'"   Set targetFolder = wmiService.ExecQuery(query)     ' report on the mail-enabled status, then toggle it   For Each folder In targetFolder       If folder.IsMailEnabled Then           WScript.Echo folder.Name &_          " was mail-enabled as " & folder.TargetAddress & "; disabling it"           folder.IsMailEnabled = false       Else         WScript.Echo folder.Name &_          " is not mail-enabled; enabling it"           folder.IsMailEnabled = true       End If       Folder.Put_   Next  WScript.Echo "Done processing folders."

Discussion

When you mail-enable a public folder, users can send messages to it via SMTP in addition to posting messages to it. Mail-enabling a folder is a simple way to provide shared access to customer service questions, suggestions, or other material that comes from outside and needs to be accessible to multiple internal users. Toggling this state is simple in ESM or from a script; the one caveat is that you're not supposed to use WMI to mail-disable a public folder in a mixed-mode organization because Exchange 5.5 assumes that every public folder is always mail-enabled. Unfortunately, there's a bug in Exchange Server 2003 that allows you to do so, so your scripts should probably be careful enough to check.

Whether you mail-enable a folder manually or via a script, its initial SMTP address will be the folder name with spaces removed (because spaces aren't valid in SMTP addresses). So "Junk Science" becomes junkscience@yourorg.com. You can add or remove this address, or other proxy addresses, using the E-mail Addresses tab of the folder properties dialog box. When you create a new mail-enabled folder, the Anonymous user token will automatically be granted Contributor permissions. This permission is required for SMTP mail sent from the Internet to be delivered to the folder. If you don't want inbound SMTP mail to be delivered, remove this permission.

Using VBScript

The script for this recipe uses a WMI query to locate the folder with the specified path; you can modify that path to select multiple folders if you prefer. For each folder returned by the query, the script toggles the IsMailEnabled property. This change isn't actually effective until the code uses the Put_ method to persist the change.

See Also

MS KB 824113 (You can use Windows Management Instrumentation to mail-disable a MAPI public folder in a mixed-mode Exchange organization) and MSDN: IsMailEnabled property of the Exchange_PublicFolder class



Exchange Server Cookbook
Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
ISBN: 0596007175
EAN: 2147483647
Year: 2006
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net