ExecuteService Method (Guid, IExternalData)


Execute a service independently of any document.

Namespace: Autodesk.Revit.DB.ExternalService
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2013

Syntax

C#
public static ExternalServiceResult ExecuteService(
	Guid executionKey,
	IExternalData data
)
Visual Basic
Public Shared Function ExecuteService ( _
	executionKey As Guid, _
	data As IExternalData _
) As ExternalServiceResult
Visual C++
public:
static ExternalServiceResult ExecuteService(
	Guid executionKey, 
	IExternalData^ data
)

Parameters

executionKey
Type: SystemGuid
Access key of the service to be executed. The key is not the same as the service's Id. It is the value that was returned to the caller who registered the service.
data
Type: Autodesk.Revit.DB.ExternalServiceIExternalData
The associated data. The type is defined by the service.

Return Value

The result of executing the external service.

Remarks

Execution of a service should be invoked only by the application that registered the service. The execution will use the currently active server (or servers in the case of a multi-server service).

This method does not take a document as one of its arguments and therefore it is not intended for executions of recordable services that may modify documents. If the service (recordable) or its server(s) is expected to modify documents, the other ExecuteService method -- the one that takes a document as one of its arguments -- is supposed to be used.

Non-recordable services are free to modify documents during this ExecuteService call, because activities of non-recordable services are not recorded; the changes those services made are assumed to be independent of the presence of the service and/or its servers.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException The execution key is either invalid or of a service that is not registered. To execute a service, the key returned by RegisterService method must be used. -or- The execution key is of a service that is already being executed.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null

See Also