ISharePointConnection.ExecuteCommand<TResult> 方法 (String)

使用指定的标识符和返回值类型执行 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 命令。有关更多信息,请参见如何:创建 SharePoint 命令如何:执行 SharePoint 命令

关于可以被 Windows Communication Foundation (WCF) 序列化的类型的详细信息,请参见 Types Supported by the Data Contract SerializerUsing the XmlSerializer Class.

.NET Framework 安全性

请参见

参考

ISharePointConnection 接口

ExecuteCommand 重载

Microsoft.VisualStudio.SharePoint 命名空间