programming4us
         
 
 
Sharepoint

SharePoint 2010 : Word Automation Services - Creating Conversion Jobs, Checking Status of Conversion Jobs

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
7/15/2013 9:29:15 PM

Word Automation Services is available as a service application in SharePoint Server 2010. Three components make up the overall architecture:

  • The architecture of the framework allows for the generation of proxy classes that can be used on the front end to access the underlying service. The Word Automation Services object model is an example of such proxy classes.

  • Document queue The Word Automation Services application makes use of a central database to maintain a queue of jobs being processed. Each job may contain one or more documents. The primary function of the service application is to write items to the queue and to retrieve details of the status of current jobs.

  • Word Automation Services engine The real work behind Word Automation Services occurs in a separate rendering engine that is capable of rendering Word documents and providing a range of features such as file format conversions, dynamic data updates, and repagination. The output of the rendering engine is then stored in the SharePoint content database as a new document.

Creating Conversion Jobs

From a front-end object model perspective, the primary interface to Word Automation Services is the ConversionJob class. The following code snippet shows how to create a job to convert a document to a PDF format:

SPFile temp = folder.Files.Add("temp.docx", mem, true);
SPServiceApplicationProxy proxy=SPServiceContext.Current.GetDefaultProxy(
                               typeof(WordServiceApplicationProxy));
ConversionJob convJob = new ConversionJob(proxy.Id);
convJob.Name = "Document Assembly";
convJob.UserToken = SPContext.Current.Web.CurrentUser.UserToken;
convJob.Settings.UpdateFields = true;
convJob.Settings.OutputFormat = SaveFormat.PDF;
convJob.Settings.OutputSaveBehavior = SaveBehavior.AlwaysOverwrite;
string siteUrl = SPContext.Current.Site.Url + "/";
string outputUrl = siteUrl + temp.Url.Replace(".docx", ".pdf");
convJob.AddFile(siteUrl + temp.Url, outputUrl);
convJob.Start();

Determining which action should be performed on all documents within a job is a job for the ConversionJobSettings class. The following class view shows the main properties:

Checking Status of Conversion Jobs

In Word Automation Services, document processing actually occurs in a separate process, and all jobs are queued for processing. As a result of this, determining the status of a submitted job is an important requirement when it comes to designing an application that makes use of the service.

We can retrieve the status of a submitted job by querying the ConversionJob object that we used to create the job. Effectively, a ConversionJob object is passed as a Windows Communication Foundation (WCF) message from client to server; on the server side, after the job has been written to the document queue database, a job identifier is returned to the client. The identifier can be obtained by querying the ConversionJob.JobId property.

Because conversion jobs can take a long time to complete, common practice is to store the job identifier for later use. A separate process can then periodically check on the status of the job, as the following snippet shows:

string ConversionJobId = SPContext.Current.ListItem.GetFormattedValue(
                                                    "ConversionJobId");

      if (!string.IsNullOrEmpty(ConversionJobId))
      {
WordServiceApplicationProxy proxy = SPServiceContext.Current.GetDefaultProxy(
typeof(WordServiceApplicationProxy)) as WordServiceApplicationProxy;

        ConversionJobStatus status = new ConversionJobStatus(
                            proxy, new Guid(ConversionJobId), null);

        if (status.Count == status.Succeeded + status.Failed)
        {
            //Job Completed
        }
        else
        {
           //Job in progress
        }
      }
		  
Other -----------------
- SharePoint 2010 : The Client Object Model (part 4) - WebPart Communication Without Postbacks
- SharePoint 2010 : The Client Object Model (part 3) - Writing the JavaScript WebPart
- SharePoint 2010 : The Client Object Model (part 2) - Writing the Silverlight WebPart
- SharePoint 2010 : The Client Object Model (part 1) - Infrastructural Objects, Object Identity
- SharePoint 2010 : Making Enterprise Content Management Work - Records Management (part 2) - Configuring Enterprise Document and Records Management
- SharePoint 2010 : Making Enterprise Content Management Work - Records Management (part 1) - Record Declaration, Information Management Policies
- SharePoint 2010 : Making Enterprise Content Management Work - Document Management (part 3) - Document IDs, Managed Metadata
- SharePoint 2010 : Making Enterprise Content Management Work - Document Management (part 2) - Document Sets
- SharePoint 2010 : Making Enterprise Content Management Work - Document Management (part 1) - Item-level Security, Versioning Settings
- SharePoint 2010 : Setting Lockdown Mode for publishing sites, Configuring Site Collection audit settings, Accessing security policy reports
- SharePoint 2010 : Checking effective permission user interface
- SharePoint 2010 : Adding a user via PowerShell, Delegating PowerShell permissions
- SharePoint Server 2010 Business Intelligence Platform (part 6) - Reporting Services
- SharePoint Server 2010 Business Intelligence Platform (part 5) - PowerPivot
- SharePoint Server 2010 Business Intelligence Platform (part 4) - PerformancePoint Services - Time Intelligence, Decomposition Tree
- SharePoint Server 2010 Business Intelligence Platform (part 3) - PerformancePoint Services - Create a Dashboard
- SharePoint Server 2010 Business Intelligence Platform (part 2) - PerformancePoint Services - Using PerformancePoint Within a Site, Dashboard Designer, PerformancePoint Data Connections
- SharePoint Server 2010 Business Intelligence Platform (part 1) - Business Intelligence Web Parts
- SharePoint 2010 : Writing Workflows with Visual Studio
- SharePoint 2010 : Writing Workflows with SharePoint Designer
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Celebrity Style, Fashion Trends, Beauty and Makeup Tips.