ISharePointConnection.ExecuteCommand<T, TResult> Method (String, T)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Executes the SharePoint command with the specified identifier, parameter type, and return value type.

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

Syntax

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

Type Parameters

  • T
    The type of the parameter of the SharePoint command to execute. This must be a type that can be serialized by Windows Communication Foundation (WCF).
  • TResult
    The type of the return value of the SharePoint command to execute. This must be a type that can be serialized by Windows Communication Foundation (WCF).

Parameters

  • commandId
    Type: System.String

    The identifier of the SharePoint command to execute.

  • arg
    Type: T

    The argument to pass to the SharePoint command.

Return Value

Type: TResult
The return value of the SharePoint command.

Exceptions

Exception Condition
InvalidOperationException

The parameter type of the SharePoint command does not match the T type.

or

The return value type of the SharePoint command does not match the TResult type.

SharePointConnectionException

An error occurred while connecting to SharePoint.

ArgumentOutOfRangeException

commandId does not match any available SharePoint commands.

SharePointCommandException

An exception was thrown by the SharePoint command.

Remarks

Use this method to execute a SharePoint command that has a return value and a custom parameter. For more information, see How to: Create a SharePoint Command and How to: Execute a SharePoint Command.

For more information about types that can be serialized by Windows Communication Foundation (WCF), see Types Supported by the Data Contract Serializer and Using the XmlSerializer Class.

.NET Framework Security

See Also

Reference

ISharePointConnection Interface

ExecuteCommand Overload

Microsoft.VisualStudio.SharePoint Namespace