共用方式為


ISharePointConnection.ExecuteCommand<TResult> 方法 (String)

更新:2010 年 9 月

執行具有指定識別項和傳回值型別的 SharePoint 命令。

命名空間:  Microsoft.VisualStudio.SharePoint
組件:  Microsoft.VisualStudio.SharePoint (在 Microsoft.VisualStudio.SharePoint.dll 中)

語法

'宣告
Function ExecuteCommand(Of TResult) ( _
    commandId As String _
) As TResult
TResult ExecuteCommand<TResult>(
    string commandId
)

型別參數

  • TResult
    要執行之 SharePoint 命令的傳回值型別。 這必須是能夠由 Windows Communication Foundation (WCF) 序列化的型別。

參數

  • commandId
    型別:System.String
    要執行之 SharePoint 命令的識別項。

傳回值

型別:TResult
SharePoint 命令的傳回值。

例外狀況

例外狀況 條件
InvalidOperationException

SharePoint 命令的傳回值型別不符合 TResult 型別。

SharePointConnectionException

連線到 SharePoint 時發生錯誤。

ArgumentOutOfRangeException

commandId 不符合任何可用的 SharePoint 命令。

SharePointCommandException

SharePoint 命令擲回例外狀況。

備註

使用這個方法來執行具有傳回值但沒有自訂參數的 SharePoint 命令。 如需詳細資訊,請參閱 HOW TO:建立 SharePoint 命令HOW TO:執行 SharePoint 命令

如需關於可透過 Windows Communication Foundation 序列化之型別的詳細資訊,請參閱Types Supported by the Data Contract SerializerUsing the XmlSerializer Class

.NET Framework 安全性

請參閱

參考

ISharePointConnection 介面

ExecuteCommand 多載

Microsoft.VisualStudio.SharePoint 命名空間

變更記錄

日期

記錄

原因

2010 年 9 月

記錄傳回值的 WCF 序列化要求。

客戶回函。