Tuesday, May 22, 2007

Scheduling audience compilation in MOSS 2007 without limits

The default user interface in Microsoft Office SharePoint Server 2007 only allows you to schedule audience compilation once a day but what if you want to do this multiple times a day? Luckily there is a workaround.

Behind the scenes audience compilation uses audiencejob.exe which you find underneath c:\program files\microsoft office servers\12.0\bin\.  To find the correct syntax just type audiencejob.exe this will give you something like

AudienceJob.exe <Application Id> <Command> [Crawl Type] [Audience Name]
Application Id: Guid corresponding to Search application
Command: 1 = Start, 0 = Stop
Crawl Type: 1 = Full, 0 = Incremental (default = 1)
Audience Name: Specific audience to compile (default = all)

Application Id for SharedServices1: be1cf629-000b-4af3-8f6c-dfc3c96563a0

For example:

C:\Program Files\Microsoft Office Servers\12.0\Bin\audiencejob be1cf629-000b-4af3-8f6c-dfc3c96563a0 1 Full all  - will recompile all audiences from scratch.

You can easily use windows scheduler which calls audiencejob.exe to create a scheduled job which runs multiple times a day.



Boxy said...

Audiencejob.exe must be a custom application, as it's not on my install of MOSS. All it looks like it's doing is calling the object model: http://www.sharepointblogs.com/wkkf/archive/2007/05/02/programmatically-compiling-audiences-in-moss2007.aspx

David said...

How did you determine the application id of SharedService1 ?

Michael B. said...

Boxy, Audiencejob.exe is not in c:\program files\common files\microsoft shared\web server extensions\12\bin, it's in c:\program files\MICROSOFT OFFICE servers\12.0\bin\. I at first thought that audiencejob.exe wasn't there because I was looking in the wrong bin folder.