共用方式為


SPFile.Convert Method

Transforms the file using the specified transformer.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)> _
Public Function Convert ( _
    ConverterId As Guid, _
    newFileName As String, _
    configInfo As String, _
    handlerAssembly As String, _
    handlerClass As String, _
    priority As Byte, _
    peopleToAlert As String, _
    sendACopy As Boolean, _
    synchronous As Boolean, _
    <OutAttribute> ByRef workItemId As Guid _
) As SPFileConversionResult
'Usage
Dim instance As SPFile
Dim ConverterId As Guid
Dim newFileName As String
Dim configInfo As String
Dim handlerAssembly As String
Dim handlerClass As String
Dim priority As Byte
Dim peopleToAlert As String
Dim sendACopy As Boolean
Dim synchronous As Boolean
Dim workItemId As Guid
Dim returnValue As SPFileConversionResult

returnValue = instance.Convert(ConverterId, _
    newFileName, configInfo, handlerAssembly, _
    handlerClass, priority, peopleToAlert, _
    sendACopy, synchronous, workItemId)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)]
public SPFileConversionResult Convert(
    Guid ConverterId,
    string newFileName,
    string configInfo,
    string handlerAssembly,
    string handlerClass,
    byte priority,
    string peopleToAlert,
    bool sendACopy,
    bool synchronous,
    out Guid workItemId
)

Parameters

  • ConverterId
    Type: System.Guid

    A System.Guid object that identifies the specific document transformer to use to transform the document.

  • newFileName
    Type: System.String

    A string that contains the leaf name of the file to be created. The extension is automatically appended by the transformer.

  • configInfo
    Type: System.String

    A string that contains the configuration information that is passed to the transform application when this transform is requested. The information is specific to the transform application and can be an empty string or a null reference (Nothing in Visual Basic).

  • handlerAssembly
    Type: System.String

    Optional. A string that specifies an assembly to load. Together with the handlerClass parameter, you can specify a pre-conversion or post-conversion handler to invoke before or after the conversion to do different tasks with the converted content, rather than just have the conversion framework make it into a file. The value of this parameter can be a null reference (Nothing in Visual Basic).

  • handlerClass
    Type: System.String

    Optional. A string that specifies a class to instantiate that is defined in the assembly specified by the handlerAssembly parameter. The class must implement the ISPConversionProcessor interface and its methods. Together with the handlerAssembly parameter, you can specify a pre-conversion or post-conversion handler to invoke before or after the conversion to do different tasks with the converted content, rather than just have the conversion framework make it into a file. The value of this parameter can be a null reference (Nothing in Visual Basic).

  • priority
    Type: System.Byte

    The priority of this transform. A lower

    priority means this transform will be processed faster. Transforms that are initiated through the user interface have a priority of 1. Bulk operations that are performed through custom script should have a lower priority.

  • peopleToAlert
    Type: System.String

    A semicolon-delimited list of email addresses of people to whom to send an alert when the transform is completed. If the string is empty or a null reference (Nothing in Visual Basic), no alert is sent.

  • sendACopy
    Type: System.Boolean

    true to attach a copy of the transformed document to the notification; otherwise, false.

  • synchronous
    Type: System.Boolean

    true to run the conversion synchronously; otherwise, false.

  • workItemId
    Type: System.Guid

    An out parameter that gets the ID of the

    work item for this asynchronous request, or that gets Guid.Empty in the case of a synchronous request.

Return Value

Type: Microsoft.SharePoint.SPFileConversionResult
An SPFileConversionResult value that indicates the conversion status.

See Also

Reference

SPFile Class

SPFile Members

Microsoft.SharePoint Namespace

ISPConversionProcessor