Home > SharePoint, SharePoint 2010 > SharePoint 2010 WAS ConversionJob

SharePoint 2010 WAS ConversionJob

Word Automation Service can be used to bulk convert files from one format to another. WAS works asynchronously by not putting much performance impact on the Application Server.

Service can read following file formats

  • Office Open XML (DOCX, DOCM, DOTX, DOTM)
  • Word 97-2003 Document (DOC) and Word 97-2003 Template (DOT)
  • Rich Text Format (RTF)
  • Single File Web Page (MHTML)
  • HTML
  • Word 2003 XML
  • Word 2007/2010 XML

Service can write following file formats

  • PDF
  • XPS
  • Office Open XML (DOCX, DOCM)
  • Word 97-2003 Document (DOC)
  • Rich Text Format (RTF)
  • Single File Web Page (MHTML)
  • Word 2007/2010 XML

WAS service job can be created using ConversionJob managed API object. Sample code

ConversionJob job = new ConversionJob("Word Automation Services")
job.UserToken = SPContext.Site.UserToken;
job.UpdateFields = true;
job.OutputFormat = SaveFormat.PDF;
job.AddFile("http://mysite/doclib/doc.docx","http://mysite/pdflib/pdf.pdf");
job.Start();

ConversionJob status can be monitored using ConversionJobStatus managed API object.

ConversionJobStatus status = new ConversionJobStatus("Word Automation Services",
             job.jobId, null);
if (status.Count == status.Succeeded)
{
   //Handle success
}
else if (status.Count == status.Failed)
{
   //Handle failure
}
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: