ISharePointConnection.ExecuteCommand<T, TResult> 方法 (String, T)

更新:2010 年 9 月

使用指定的标识符、参数类型和返回值类型执行 SharePoint 命令。

命名空间:  Microsoft.VisualStudio.SharePoint
程序集:  Microsoft.VisualStudio.SharePoint(在 Microsoft.VisualStudio.SharePoint.dll 中)

语法

声明
Function ExecuteCommand(Of T, TResult) ( _
    commandId As String, _
    arg As T _
) As TResult
TResult ExecuteCommand<T, TResult>(
    string commandId,
    T arg
)

类型参数

  • T
    要执行的 SharePoint 命令的参数的类型。 这必须是可由 Windows Communication Foundation (WCF) 序列化的类型。
  • TResult
    要执行的 SharePoint 命令的返回值的类型。 这必须是可由 Windows Communication Foundation (WCF) 序列化的类型。

参数

  • commandId
    类型:System.String
    要执行的 SharePoint 命令的标识符。
  • arg
    类型:T
    要传递给 SharePoint 命令的参数。

返回值

类型:TResult
SharePoint 命令的返回值。

异常

异常 条件
InvalidOperationException

SharePoint 命令的参数类型与 T 类型不匹配。

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 命名空间

修订记录

Date

修订记录

原因

2010 年 9 月

记录参数和返回值的 WCF 序列化要求。

客户反馈