ISharePointConnection.ExecuteCommand<TResult> Method (String)
[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 return value type.
Namespace: Microsoft.VisualStudio.SharePoint
Assembly: Microsoft.VisualStudio.SharePoint (in Microsoft.VisualStudio.SharePoint.dll)
Syntax
'Declaration
Function ExecuteCommand(Of TResult) ( _
commandId As String _
) As TResult
TResult ExecuteCommand<TResult>(
string commandId
)
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
Type: System.StringThe identifier of the SharePoint command to execute.
Return Value
Type: TResult
The return value of the SharePoint command.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | 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 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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.