In the Word Automation Companies: What It Does publish, I offered an incredibly high-level outline on the server-side API supplied by the service,
cheap microsoft windows 7 activation, displaying you the fundamental outline for functioning with the company: a ConversionJob Give it the settings for that conversion(s) to execute Consumer credentials to fetch/store files Target file format for output Etc. Inform it though file(s) to process Start out (optionally) Monitor progress
In this post, I wished to check out a specific instance remedy and what's associated with building it, to stroll via a true instance with the services end-to-end.
In this illustration, I've a library through which I keep contracts as they are becoming created. After they're approved, I set the Standing home for that document within just the library to "Final" and an XPS version of it can be immediately produced to archive the agreed-upon edition with the subject matter. Choice
I've created up the alternative in tutorial sort, so people w/ Visual Studio 2010 and SharePoint 2010 can definitely produce the resulting workflow; if that's not your target, searching the sample code need to be sufficient to provide you an plan of how the option operates. the Document Content material Type
Before we start, we add the Status column on the Document content material type,
microsoft windows 7 ultimate 64 bit key, in order that we can use it in this particular walkthrough. the SharePoint blog, opt for Site Actions (inside the upper-left hand corner), then click on Website Settings. Beneath the ################## heading, decide on Website Content material Forms. Click on on Document to edit its content material style. Decide Add from present online site columns. While in the To choose from Columns checklist, get Status and click Add to add it on the list of columns to add. Be aware: If Status can't be found, it may currently have already been added for the content style. Click Okay. Developing the Venture
First, we design a SharePoint project in Visual Studio which will incorporate our workflow code. Visual Studio 2010 as an administrator. Notice: You will need to get started Visual Studio as an administrator to be able to productively publish the undertaking for the SharePoint farm. Beneath the File menu, select New,
microsoft office pro plus 2010 activation key, and after that Project… While in the New Task dialog box, find the Visual C# SharePoint 2010 venture sort. Pick Sequential Workflow in the template list. Give the task a identify (e.g. ArchiveDocument). Click on Okay to make the undertaking. When asked, choose to Deploy as being a farm choice. Notice: It is requested because the Word Automation Companies object model cannot be accessed from partially trusted code. Around the next step, give the workflow a friendly title, e.g. "Archive Document" and choose List Workflow since the workflow type. Leave the default association settings, and click on Up coming. Be aware: If you need to attach the workflow to a specific listing, modify the Checklist drop-down to that listing. During this tutorial, we'll use the default Shared Paperwork listing on the SharePoint page. Uncheck "On item creation" within the default settings for workflow initiation (leaving "Manually" because the only chosen value), and click on Complete.
At this stage, we now possess a new empty workflow project. on the Word Automation Providers Object Model
To accomplish conversions, we need to involve a reference to the Phrase Automation Providers object model. the Answer Explorer window, right-click on References and determine Add Reference… Browse to locate the reference working with the Browse tab. The Microsoft.Office.Phrase.Server.dll assembly is positioned with the SharePoint Server 2010 ISAPI folder, often positioned at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI.
Okay to add the reference.
Note: If you happen to get a warning the DLL involves a more recent model on the .NET Framework, select Indeed to add the reference anyway. Then, add a reference to Procedure.Website.DataVisualization, often located at C:\windows\Assembly\GAC_MSIL\System.Net.DataVisual ization\3.five.0.0__31bf3856ad364e35\. Workflow
Now that we now have a workflow challenge, we will add a two-step workflow: the primary step checks regardless of whether the Standing house is set to "Final"; when it's got,
office 2007 keygen sale, the second phase converts the document. Test the Status House Through the Toolbox, under Windows Workflow v3.0, add a Whilst exercise just after the existing onWorkflowActivated exercise. From your Toolbox, under SharePoint Workflow, add an OnWorkflowItemChanged activity within the While activity. Click on about the OnWorkflowItemChanged activity. From your Attributes window, set the value with the CorrelationToken house to workflowToken (the sole merchandise in the drop-down list).
tells the exercise the data needed to affiliate the ItemChanged celebration using the accurate workflow. Attributes window, click on about the lightning bolt to switch to Activities view, and press ENTER with the Invoked strategy to make a blank celebration handler. This celebration handler shall be triggered every time the merchandise adjustments. While in the code window, add a global Boolean value to track irrespective of whether the Status home has been set to your desired value:
bool documentReady = false; the event handler, add code to check the worth of the column, and set the documentReady variable appropriately:
//check if your Status is set to final; in that case, the document is able to archive
if (workflowProperties.Item["Status"] != null)
_documentReady = ((string)workflowProperties.Item["Status"] == "Final");
towards the workflow designer window. Be aware: It will have a very name like Workflow.cs [Design]. Click on around the Even though exercise. Through the properties window, click on Condition and decide upon Declarative Rule Condition. Expand the Condition field, exposing ConditionName and Expression:
the ConditionName field, give the condition a identify, e.g. Wanting to Archive. Click on from the Expression field, and press the button to set the condition. During the dialog box, variety the following condition:
documentReady == untrue to save the condition.
The resulting workflow now looks like:
2: Convert the Document
Now that we've created the portion of the workflow that waits for your column worth to be set to Final, we add the workflow activity to seriously convert the document. the Toolbox, beneath Windows Workflow v3.0, add a Code activity just after the current Whereas activity. In the Properties window, click on the lightning bolt to switch to Activities watch, and press ENTER within the ExecuteCode system to create a blank event handler. This function handler might be triggered anytime the merchandise modifications. With the function handler, add code to accomplish the conversion:
//create a conversion job
ConversionJob job = new ConversionJob("Word Automation Services"); settings
job.UserToken = workflowProperties.OriginatorUser.UserToken;
if (workflowProperties.Web site.SiteSubscription != null)
job.SubscriptionId = workflowProperties.Online site.SiteSubscription.Id;
job.Settings.OutputFormat = SaveFormat.XPS;
job.Name = "Archive Document Workflow"; file
string fileUrl = workflowProperties.WebUrl + "/" + workflowProperties.ItemUrl;
job.AddFile(fileUrl, Path.ChangeExtension(fileUrl, "xps")); conversion
job.Start out(); code creates a brand new ConversionJob, which defines a set of conversions, supplying the identify of the services application. Note: This illustration assumes the title for the service application is "Word Automation Services", which is the default identify when it is created via the Farm Configuration Wizard. Once you have used a different identify for the services application,
cheap microsoft office 2007 sale, improve the name as appropriate. set the mandatory settings for the conversion: UserToken residence, which specifies the user credentials used to read the input file and write the output file. The SubscriptionId home, which specifies the web page subscription ID in the website. Note: This parameter is only expected if the SharePoint farm has become configured in partitioned mode. The OutputFormat home, which specifies the output file format for your conversion.
As well, we specify one optional setting: Name property, which specifies a pleasant name for the conversion.
Next, we add the file on the conversion job via the AddFile strategy, and begin the processing for the conversion making use of the Get started technique. workflow now looks like: Action 3: Keep track of the Conversion
Once we've scheduled the conversion, it really is processed asynchronously. Finally, we will add a step to keep track of the result in the conversion just before terminating the workflow, so that the workflow completes right after the conversion. the Toolbox, under Windows Workflow v3.0, add a Although exercise just after the present codeActivity activity. From your Toolbox, underneath Windows Workflow v3.0, add a Sequence activity within the When activity. In the Toolbox, beneath Windows Workflow v3.0, add a Delay activity inside the Sequence exercise. Click about the new codeActivity exercise. From your Attributes window, click around the TimeoutDuration residence and set it to 00:00:30 (30 seconds). This means that the workflow will undoubtedly be re-checked at most every 30 seconds. Notice: Mainly because delays in SharePoint workflows are processed making use of a timer job with a default frequency of five minutes, it could take up to 4:59 for the delay to be processed. From the Toolbox, under Windows Workflow v3.0, add a Code activity once the Delay exercise. Click on about the new codeActivity exercise. Through the Properties window, click about the lightning bolt to change to Activities view, and press ENTER in the ExecuteCode way to make a blank celebration handler. This occasion handler will be triggered anytime the item alterations. Inside code window, add two international variables: a Guid worth to shop the ID for the conversion, in order that we will verify it on regular intervals, and a Boolean to track irrespective of whether the conversion completed effectively:
Guid jobId;
bool conversionComplete = false; the 1st code method, retail store the ID with the conversion job into this world wide variable, by adding the following code just after the Commence procedure:
//save the job's ID
jobId = job.JobId; the new celebration handler (created in Stage 6), add code to check the standing of your conversion:
//monitor the conversion
//get the webpage subscription ID
Guid? siteSubscription = null;
if (workflowProperties.Web site.SiteSubscription != null)
siteSubscription = workflowProperties.Web site.SiteSubscription.Id; the conversion is complete; if it is actually, refresh
ConversionJobStatus standing = new ConversionJobStatus("Word Automation Services", jobId, siteSubscription);
if (status.Count == position.Succeeded)
//success!
conversionComplete = true;
else if (position.Count == status.Failed)
//conversion failed
ReadOnlyCollection<ConversionItemInfo> failedItems = status.GetItems(ItemTypes.Failed);
throw new Exception(failedItems[0].ErrorMessage);
else if (standing.Count == standing.Canceled)
//conversion was canceled
throw new Exception("Conversion was canceled.");
didn't finish, keep waiting checks the position from the conversion making use of the ConversionJobStatus object. Note: This instance assumes the name for the company application is "Word Automation Services", which is the default title when it happens to be created via the Farm Configuration Wizard. If you ever have used a different name for the services application, modify the identify as appropriate. have the standing for your job, we will check out whether the item has succeeded or failed, and react accordingly. Otherwise, we do nothing, since the conversion is still in progress. towards the workflow designer window. Be aware: It will possess a name like Workflow.cs [Design]. Click on around the Despite the fact that activity. From the properties window, click on on Condition and pick Declarative Rule Condition. Expand the Condition field, exposing ConditionName and Expression:
the ConditionName field, give the condition a name, e.g. Conversion Complete. Click on in the Expression field, and press the button to set the condition. Inside the dialog box, form the following condition:
conversionComplete == ######## to save the condition.
The ultimate workflow may want to appearance like this: Deploy the Option
Now, deploy the remedy to your SharePoint farm. the Construct menu, select Deploy Solution to build up the code and deploy it to SharePoint. Through the Shared Paperwork library (or whichever library you chose in Stage 9 of Developing the Undertaking), upload a new Phrase document to begin the workflow. Right-click on the new document and opt for Workflows. Click on Archive Document to launch the workflow. Right-click around the new document and decide upon Edit Attributes. Set the Status home to Last. Press Okay.
When the timer job runs and the conversion is processed, you should certainly see the XPS file appear future towards the original document (refresh the page to see the result). Be aware: Again, because the conversions are processed applying a timer job, it might take up to your frequency for the timer job for the file to appear.