Share via


ISharePointConnection.ExecuteCommand Method

Definition

Overloads

ExecuteCommand(String)

Executes the SharePoint command with the specified identifier.

ExecuteCommand<T,TResult>(String, T)

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

ExecuteCommand<T>(String, T)

Executes the SharePoint command with the specified identifier and parameter type.

ExecuteCommand<TResult>(String)

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

ExecuteCommand(String)

Executes the SharePoint command with the specified identifier.

public:
 void ExecuteCommand(System::String ^ commandId);
public void ExecuteCommand (string commandId);
abstract member ExecuteCommand : string -> unit
Public Sub ExecuteCommand (commandId As String)

Parameters

commandId
String

The identifier of the SharePoint command to execute.

Exceptions

An error occurred while connecting to SharePoint.

commandId does not match any available SharePoint commands.

An exception was thrown by the SharePoint command.

Remarks

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

Applies to

ExecuteCommand<T,TResult>(String, T)

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

public:
generic <typename T, typename TResult>
 TResult ExecuteCommand(System::String ^ commandId, T arg);
public TResult ExecuteCommand<T,TResult> (string commandId, T arg);
abstract member ExecuteCommand : string * 'T -> 'Result
Public Function ExecuteCommand(Of T, TResult) (commandId As String, arg As T) As TResult

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
String

The identifier of the SharePoint command to execute.

arg
T

The argument to pass to the SharePoint command.

Returns

TResult

The return value of the SharePoint command.

Exceptions

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

An error occurred while connecting to SharePoint.

commandId does not match any available SharePoint commands.

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.

Applies to

ExecuteCommand<T>(String, T)

Executes the SharePoint command with the specified identifier and parameter type.

public:
generic <typename T>
 void ExecuteCommand(System::String ^ commandId, T arg);
public void ExecuteCommand<T> (string commandId, T arg);
abstract member ExecuteCommand : string * 'T -> unit
Public Sub ExecuteCommand(Of T) (commandId As String, arg As T)

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
String

The identifier of the SharePoint command to execute.

arg
T

The argument to pass to the SharePoint command.

Exceptions

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

An error occurred while connecting to SharePoint.

commandId does not match any available SharePoint commands.

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.

Applies to

ExecuteCommand<TResult>(String)

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

public:
generic <typename TResult>
 TResult ExecuteCommand(System::String ^ commandId);
public TResult ExecuteCommand<TResult> (string commandId);
abstract member ExecuteCommand : string -> 'Result
Public Function ExecuteCommand(Of TResult) (commandId As String) As TResult

Type Parameters

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
String

The identifier of the SharePoint command to execute.

Returns

TResult

The return value of the SharePoint command.

Exceptions

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

An error occurred while connecting to SharePoint.

commandId does not match any available SharePoint commands.

An exception was thrown by the SharePoint command.

Remarks

Use this method to execute a SharePoint command that has a return value but no 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.

Applies to