Subscribe to Windows IT Pro
December 22, 2003 12:00 AM

Managing Exchange 2003 with WMI, Part 2

How to manage public folders
Windows IT Pro
InstantDoc ID #41022
Rating: (0)
Downloads
41022.zip

Performing Other Operations
The Exchange_PublicFolder class's methods—AddReplica, RemoveReplica, SendChanges, Copy, Move, Rename, PropagateSettings, and Synchronize—let you perform other public folder operations. Each method requires specific input parameters.

AddReplica and RemoveReplica. The AddReplica and RemoveReplica methods let you create and remove replicas, respectively. The only parameter for these methods is the distinguished name (DN) of the IS in which you'll manage the replicas. The Exchange_FolderTree class's AssociatedPublicStores property holds the DN of the relevant IS for the specified public folder hierarchy. Thus, to find the DN, you can run GetCollectionOfInstances.wsf against the WQL query that exposes the Exchange_FolderTree class instances. After you know the DN, you can use a script such as CreateReplica.wsf. This script, which you can download from the Exchange & Outlook Administrator Web site, uses the AddReplica method to create a replica.

SendChanges. The SendChanges method sends a public folder's modifications to its replica. The method requires two parameters: an integer that represents how often (in terms of number of days) to send the modifications and the DN of the public folder's IS.

Synchronize. The Synchronize method forces synchronization between public folders and their replicas. The Synchronize method doesn't take any parameters.

Although Synchronize and SendChanges both perform synchronization, they differ in two ways. Both Synchronize and SendChanges send the local changes to the replicas, but the Synchronize method also sends changes of other replicas to the local folder. Moreover, the Synchronize method occurs against all replicas, whereas the SendChanges method lets you select the replicas with which you want to synchronize.

Copy and Move. With the Copy and Move methods, you can copy and move public folders. These methods require one parameter: the friendly URL of the folder you want to copy or move. It's the same type of URL as the ParentFriendlyUrl property you specify when creating a public folder. The script CopyPublicFolder, which you can download from the Exchange & Outlook Administrator Web site, demonstrates how to use the Copy method to duplicate a public folder.

Rename. The Rename method lets you rename a public folder. This method requires one parameter: the public folder's new name.

PropagateSettings. The PropagateSettings method disseminates a public folder's settings to all its child folders. This method takes one required and one optional parameter. The required parameter is an integer that represents the flags (i.e., settings) for the public folder. Each flag corresponds to a bit in a bit pattern. The integer is the sum of the values representing the desired bits. Web Table 3 shows the bits and their values. The optional parameter is a Boolean value that specifies whether to stop the execution of the method if an error occurs.

Take Small Steps
Programmatically managing Exchange's public folders has always been a challenge, mainly because of Exchange's lack of management tools. Exchange 2003's new WMI providers and classes make public folder management through scripts much easier. A script exploiting all the capabilities of the Exchange_PublicFolder and Exchange_FolderTree classes would be quite daunting. But, as you've witnessed in this article, if you look at each capability separately, the classes are easier to understand. I'll take this same approach in Part 3 of this series, in which I'll show you how to programmatically manage queues with a new set of WMI classes dedicated to Exchange queue management.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.