次の方法で共有


SPFile.SendToOfficialFile method (String, String)

Sends the file to a records repository and specifies the name of a record routing type.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Function SendToOfficialFile ( _
    recordSeries As String, _
    <OutAttribute> ByRef additionalInformation As String _
) As OfficialFileResult
'Usage
Dim instance As SPFile
Dim recordSeries As String
Dim additionalInformation As String
Dim returnValue As OfficialFileResult

returnValue = instance.SendToOfficialFile(recordSeries, _
    additionalInformation)
public OfficialFileResult SendToOfficialFile(
    string recordSeries,
    out string additionalInformation
)

Parameters

  • recordSeries
    Type: System.String

    System.String value that contains the name of a record routing type.

  • additionalInformation
    Type: System.String

    When this method returns, contains a System.String that provides detailed information returned by the Records Center Web service in response to this request. This parameter is passed uninitialized. For more information, see Records Center Web Service Methods.

Return value

Type: Microsoft.SharePoint.OfficialFileResult
An OfficialFileResult enumeration value.

Remarks

This method submits a file for archiving in a Records Center. For more information, see Records Center Overview.

If a Records Center Web service is configured for the current Web application, users can right-click a document in a library and choose Send to Records center from the edit control block menu. You can use the SendToOfficialFile method to automate the same operation, perhaps in an event handler or as part of a workflow.

If the Web service returns OfficialFileResult.MoreInformation, detailed information is output to the variable named in the argument to the additionalInformation parameter.

Examples

This example shows how to send a file to the official records repository.

public void ArchiveFile(SPFile file)
{
    String recordSeries = file.Item.ContentType.Name;
    String additionalInformation = null;
    OfficialFileResult returnValue;

    // WSS needs the file to be checked in to know which version to send.
    if (file.Level == SPFileLevel.Checkout)
    {
        file.CheckIn(String.Empty, SPCheckinType.MinorCheckIn);
    } 
    
    returnValue = file.SendToOfficialFile(recordSeries, out additionalInformation);

    // Custom code for handling the response from the service.
    switch (returnValue)
    {
        case OfficialFileResult.MoreInformation:
            // Notify user.
            break;
        case OfficialFileResult.Success:
            //Notify user.
            break;
        default:
            // Handle error.
            break;
    }
}
Public Sub ArchiveFile(ByRef file As SPFile)

    Dim recordSeries As String = file.Item.ContentType.Name
    Dim additionalInformation As String = null
    Dim returnValue As OfficialFileResult

    ' WSS needs the file to be checked in to know which version to send.
    If file.Level = SPFileLevel.Checkout Then
        file.CheckIn(String.Empty, SPCheckinType.MinorCheckIn)
    End If

    returnValue = file.SendToOfficialFile(recordSeries, additionalInformation)

    ' Custom code for handling the response from the service.
    Select Case returnValue
        Case OfficialFileResult.MoreInformation
            ' notify user
        Case OfficialFileResult.Success
            'notify user
        Case Else
            ' handle error
    End Select
End Sub

See also

Reference

SPFile class

SPFile members

SendToOfficialFile overload

Microsoft.SharePoint namespace

OfficialFileResult

Other resources

Records Center Overview

Records Center Web Service Methods