Export (0) Print
Expand All

Step 1: Set Up the Visual Studio 2010 Project For the Web Part Solution

SharePoint 2010

Last modified: April 07, 2010

Applies to: SharePoint Server 2010

This topic shows how to set up for the Word Automation Services Web Part example solution.

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

  1. Navigate to a site on your SharePoint Server 2010 server for which you have permissions to create a document library.

  2. Click Site Actions and then click New Document Library.

  3. Name the document library Input.

  4. Click Create.

    This document library is the file input location for the Word Automation Services conversion job. For example, http://wordserver/demo/input/.

  5. Click Site Actions and then click New Document Library.

  6. Name the document library Output.

  7. 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

  1. Start Visual Studio 2010 as an administrator.

    Important note Important

    You must start Visual Studio 2010 as an administrator in order to successfully publish the project to the SharePoint 2010 farm.

  2. Click File, point to New, and then click Project…

  3. In the New Project dialog box, under Installed Templates, expand Visual C# (if it is not already expanded), expand SharePoint, and then click 2010.

  4. In the list of template types, select Visual Web Part.

  5. Give the project a name, for example, ConvertDocuments.

  6. Click OK to begin creating the project.

  7. On the Specify the site and security level for debugging page of the SharePoint Customization Wizard verify the SharePoint site for the solution.

  8. 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 note 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.

  9. 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

  1. In Solution Explorer, right-click References and then click Add Reference…

  2. 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

  3. Select Microsoft.Office.Word.Server.dll and then click OK to add the reference.

    Note 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\

Show:
© 2014 Microsoft