SPFile.SendToOfficialFile method (String, String)
將檔案傳送到記錄存放庫,並指定 [記錄路由型別名稱。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Function SendToOfficialFile ( _
recordSeries As String, _
<OutAttribute> ByRef additionalInformation As String _
) As OfficialFileResult
'用途
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
)
參數
recordSeries
Type: System.String包含的資料錄的路由類型名稱的System.String值。
additionalInformation
Type: System.String這個方法傳回時,包含提供詳細的資訊,以回應這個要求的記錄中心 Web 服務傳回的System.String 。這個參數會傳遞未初始化。如需詳細資訊,請參閱Records Center Web Service Methods。
傳回值
Type: Microsoft.SharePoint.OfficialFileResult
OfficialFileResult 列舉值。
備註
這個方法會送出檔案,以保存在資料錄中心。如需詳細資訊,請參閱Records Center Overview。
如果記錄中心 Web 服務設定為目前的 Web 應用程式時,使用者可以用滑鼠右鍵按一下文件庫中的文件,並從編輯控制區塊] 功能表中選擇 [傳送到記錄中心。您可以使用SendToOfficialFile方法來自動化相同的作業,可能是在事件處理常式或工作流程的一部分。
如果 Web 服務傳回OfficialFileResult.MoreInformation,詳細的資訊會都會輸出到名為additionalInformation參數的引數中的變數。
Examples
本範例顯示如何將檔案傳送到正式記錄存放庫。
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
請參閱
參照
Microsoft.SharePoint namespace