Okay, so you’ve created your audience and used my gl-addaudiencerule command to add some complex rules to the audience. Three months later you’ve forgotten what those rules are and need to see them again – unfortunately you can’t do that via the browser, so what do you do? Simple, you run gl-enumaudiencerules, another command I’ve created to help manage audiences via STSADM.
This command is really simple so I’ll be brief – I simply loop through all the rules associated with an audience and display back an XML structure representing those rules. The nice thing about this is that you can use it to help build your rules to assign using the gl-addaudiencerule command – you’d create all the rules you need via the browser, with no groupings, and then use this command to get the XML and then simply add your grouping elements into the XML – this way you’re sure the field names are correct.
Here’s a snippet of the code:
The help for the command is shown below:
C:\>stsadm -help gl-enumaudiencerules stsadm -o gl-enumaudiencerules Outputs the rules for an audience. Parameters: -name <audience name> [-ssp <SSP name>] [-explicit (shows field and value attributes for every rule)]
The following table summarizes the command and its various parameters:
|Command Name||Availability||Build Date|
|Parameter Name||Short Form||Required||Description||Example Usage|
|name||n||Yes||The name of the audience||-name "IT Department"
-n "IT Department"
|ssp||No||The name of the SSP that the audience is associated with. If not specified then the default SSP is used.||-ssp SSP1|
|explicit||ex||No||If specified then all attributes will be returned in the XML – this is only really useful if you wish to see the field names of the special operators, "member of" and "reports under".||-explicit
The following is an example of how to display the rules associated with an audience:
stsadm -o gl-enumaudiencerules -name "IT Department"
The following is an example of the XML that would be displayed: