Delen via


ISharePointConnection.ExecuteCommand<T> 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 and parameter type.

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

Syntax

'Declaration
Sub ExecuteCommand(Of T) ( _
    commandId As String, _
    arg As T _
)
void ExecuteCommand<T>(
    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).

Parameters

  • commandId
    Type: System.String

    The identifier of the SharePoint command to execute.

  • arg
    Type: T

    The argument to pass to the SharePoint command.

Exceptions

Exception Condition
InvalidOperationException

The parameter type of the SharePoint command does not match the T 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 custom parameter but no return value. 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