Step 1: Set Up the Visual Studio 2010 Project For the Web Part Solution
Applies to: SharePoint Server 2010
This topic shows how to set up for the Word Automation Services Web Part example solution.
Setting Up For the Word Automation Services Web Part Solution Example
The custom application that you create in this walkthrough takes a given set of files from the specified SharePoint Document Library as input, uses Word Automation Services to convert the files to a specified output format, and then places the converted files into the output SharePoint Document Library.
In the following procedure, you create SharePoint Document Libraries for the input and output of a Word Automation Services conversion job.
To create the input and output SharePoint document libraries
Navigate to a site on your SharePoint Server 2010 server for which you have permissions to create a document library.
Click Site Actions and then click New Document Library.
Name the document library Input.
Click Create.
This document library is the file input location for the Word Automation Services conversion job. For example, http://wordserver/demo/input/.
Click Site Actions and then click New Document Library.
Name the document library Output.
Click Create.
This document library is the file output location for the Word Automation Services conversion job. For example, http://wordserver/demo/output/.
This walkthrough shows how to initiate a Word Automation Services conversion job using a Web Part. To create the Web Part, use the Visual Studio 2010 Visual Web Part template.
To create the Visual Studio 2010 Visual Web Part project
Start Visual Studio 2010 as an administrator.
Important
You must start Visual Studio 2010 as an administrator in order to successfully publish the project to the SharePoint 2010 farm.
Click File, point to New, and then click Project…
In the New Project dialog box, under Installed Templates, expand Visual C# (if it is not already expanded), expand SharePoint, and then click 2010.
In the list of template types, select Visual Web Part.
Give the project a name, for example, ConvertDocuments.
Click OK to begin creating the project.
On the Specify the site and security level for debugging page of the SharePoint Customization Wizard verify the SharePoint site for the solution.
Also on the Specify the site and security level for debugging page of the SharePoint Customization Wizard, ensure that Deploy as a farm solution is selected.
Important
You must select the option Deploy as a farm solution because the Word Automation Services object model cannot be accessed from partially-trusted code.
Click Finish to complete creating the project.
To use the Word Automation Services object model in code, add a reference to the Word Automation Services assembly.
To add a reference to Word Automation Services
In Solution Explorer, right-click References and then click Add Reference…
In the Add Reference dialog box, click the Browse tab. The Microsoft.Office.Word.Server.dll assembly is located in the SharePoint Server 2010 \ISAPI folder, which usually has the following path:
%systemdrive%:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI
Select Microsoft.Office.Word.Server.dll and then click OK to add the reference.
Note
If you receive a warning that Microsoft.Office.Word.Server.dll requires a newer version of the .NET Framework, click Yes to add the reference. Then, add a reference to System.Web.DataVisualization, which usually has the following path:
%windir%\Assembly\GAC_MSIL\System.Web.DataVisualization\3.5.0.0__31bf3856ad364e35\
See Also
Tasks
Step 3: Build and Deploy the Web Part Solution
Concepts
Walkthrough: Creating a Web Part That Uses Word Automation Services