Compartilhar via


Document Converter Object Model in SharePoint Server 2010 (ECM)

Applies to: SharePoint Server 2010

The SharePoint Foundation object model contains members that represent the document converters in a specified Web application, as well as the converted copies in a given document library.

Object Model Members for Document Converters

You can configure the document converters in a given Web application programmatically by using the following members of the Microsoft.SharePoint.Administration namespace:

  • DocumentConverters   Returns an SPDocumentConverterCollection object that represents the document transformers currently installed for the Web application.

  • DocumentConversionsEnabled   Gets or sets whether document transformers are enabled for the Web application.

  • DocumentConversionsLoadBalancerUrl   Gets or sets the URI of the server that is running the DocConvLoadBalancer service for the Web application.

  • DocumentConversionsSchedule   Gets or sets the document converter schedule.

  • SPDocumentConverterCollection   Represents the document transformers currently installed for the Web application.

  • SPDocumentConverter   Represents a single document transformer currently installed for the Web application. This object contains read-only properties that represent the converter settings defined in the Document Converter Definition Schema, such as the converter name, assembly name, "to" and "from" file name extensions, and converter user interface pages. In addition, each SPDocumentConverter instance also includes converter settings that are set by the administrator at the Web-application level. These Web application-specific settings include whether to display the document converter in the user interface for end users, maximum number of retries, maximum file size for conversions, and time-out length.

    For more information, see Document Converter Definition Schema in SharePoint Server 2010 (ECM).

Object Model Members for Converted Documents

You can identify and work with original files and their converted copies programmatically by using the following members of the SPFile object:

  • Convert   This method creates a converted copy of the specified document, using the specified document converter. You can also specify custom configuration information to pass to the document converter, the file name of the converted copy, the conversion priority, the e-mail addresses of people to alert, and whether to include the converted copy as an attachment to the alert. To have a custom assembly perform post-processing on the converted copy, instead of Microsoft SharePoint Server 2010, you can specify a custom handler assembly and class. If you do not specify a custom handler, SharePoint Server 2010 performs its usual post-processing of the converted copy.

    For more information on custom processing, see Custom Processing of Converted Documents in SharePoint Server 2010 (ECM).

    For more information on the post-processing SharePoint Server 2010 performs by default, see Converted Documents in SharePoint Server 2010 (ECM). The return type, SPFileConversionResult, indicates the result of the document conversion.

  • GetConvertedFile   Returns the converted copy generated from this file by the specified document converter. Returns null if there is no converted copy generated by the specified converter.

  • GetConversionState   Returns an SPFileConversionState enumeration that represents the state of a conversion using the specified document converter. You can call this method to determine if a conversion using this document converter is even possible. Values for the SPFileConversionState enumeration include:

    • Available   A conversion of this file by using the specified document converter is supported on this system.

    • Completed   A conversion of this file using the specified document converter is not completed.

    • NotAvailable   A conversion of this file using the specified document converter is not supported on this system.

    • Pending   A conversion of this file using the specified document converter is requested, but is not yet completed.

  • IsConvertedFile  Returns true if the file is a converted copy of another document.

  • SPFile.ParentFile   Returns an SPFile object that represents the original document used to create this converted copy. Returns null if the selected file is not a converted copy.

  • GeneratingConverterId   Returns the GUID of the document converter used to create this converted copy. Returns null if the selected file is not a converted copy.

  • Generator   Returns the name of the document converter used to create this converted copy.

See Also

Concepts

SharePoint Server 2010 Document Converter Development Overview (ECM)

Document Converters in SharePoint Server 2010 (ECM)