Monday, November 1, 2010

Word Automation Services Job History

I recently had to make use of the Word Automation Service application to convert word documents to pdf within sharepoint. If you have used the service application before you will be aware that once you queue a document you have to wait for the timer job to run before the document can be converted. There are some solutions which poll the service to see if the conversion process has completed successfully, but what if you what to view the status of previous and failed conversions? I couldn't find anywhere within Central Administration to view the history (let me know if I'm missing something!).

I knocked together the following powershell to output the jobs and their status.

[void][reflection.assembly]::Loadwithpartialname(“Microsoft.Office.Word.Server") out-null
[Microsoft.Office.Word.Server.Conversions.ConversionJobStatus]::GetAllJobs("Word Automation Services", $null) foreach {
$status = new-object Microsoft.Office.Word.Server.Conversions.ConversionJobStatus("Word Automation Services", $_.JobId,$null);
$_;
$status;
$status.GetItems([Microsoft.Office.Word.Server.Conversions.ItemTypes]::Succeeded)
$status.GetItems([Microsoft.Office.Word.Server.Conversions.ItemTypes]::InProgress)
$status.GetItems([Microsoft.Office.Word.Server.Conversions.ItemTypes]::NotStarted)
$status.GetItems([Microsoft.Office.Word.Server.Conversions.ItemTypes]::Failed)
$status.GetItems([Microsoft.Office.Word.Server.Conversions.ItemTypes]::Canceled)

}