CrmServiceClient Class

 

Updated: November 29, 2016

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Provides the low-level interaction and wrapper methods to connect to Microsoft Dynamics CRM and execute actions.

Namespace:   Microsoft.Xrm.Tooling.Connector
Assembly:  Microsoft.Xrm.Tooling.Connector (in Microsoft.Xrm.Tooling.Connector.dll)

System.Object
  Microsoft.Xrm.Tooling.Connector.CrmServiceClient

public sealed class CrmServiceClient : IOrganizationService

NameDescription
System_CAPS_pubmethodCrmServiceClient(NetworkCredential, AuthenticationType, String, String, String, Boolean, Boolean, OrganizationDetail)

Initializes a new instance of the CrmServiceClient class using the specified network credentials and authentication type as AD or IFD

System_CAPS_pubmethodCrmServiceClient(NetworkCredential, String, String, String, Boolean, Boolean, OrganizationDetail)

Initializes a new instance of the CrmServiceClient class using the specified network credentials and Active Directory (AD) authentication.

System_CAPS_pubmethodCrmServiceClient(OrganizationServiceProxy)

Initializes a new instance of the CrmServiceClient class using the Organization service proxy provided by the user.

System_CAPS_pubmethodCrmServiceClient(OrganizationWebProxyClient)

Initializes a new instance of the CrmServiceClient class using the OrganizationWebProxyClient instance provided by the user.

System_CAPS_pubmethodCrmServiceClient(String)

Initializes a new instance of the CrmServiceClient class using a connection string.

System_CAPS_pubmethodCrmServiceClient(String, SecureString, String, String, Boolean, Boolean, OrganizationDetail, Boolean)

Initializes a new instance of the CrmServiceClient class using the specified network credentials and authentication type as Office 365.

System_CAPS_pubmethodCrmServiceClient(String, SecureString, String, String, Boolean, OrganizationDetail, UserIdentifier, String, Uri, String, OrganizationWebProxyClient, PromptBehavior)

Initializes a new instance of the CrmServiceClient using the OAuth protocol to connect to your CRM Online instance in Office 365.

System_CAPS_pubmethodCrmServiceClient(String, SecureString, String, String, String, String, String, Boolean, Boolean, OrganizationDetail)

Initializes a new instance of the CrmServiceClient class using the specified network credentials and claims-based authentication.

System_CAPS_pubmethodCrmServiceClient(String, SecureString, String, String, String, String, String, Boolean, Boolean, OrganizationDetail, UserIdentifier, String, Uri, String, OrganizationWebProxyClient, PromptBehavior)

Initializes a new instance of the CrmServiceClient class using the specified network credentials and OAuth protocol.

NameDescription
System_CAPS_pubpropertyActiveAuthenticationType

Gets the authentication type used for the active CRM connection.

System_CAPS_pubpropertyAuthority

System_CAPS_pubpropertyCallerId

System_CAPS_pubpropertyConnectedOrgFriendlyName

Gets the friendly name of the organization that you are connected to.

System_CAPS_pubpropertyConnectedOrgPublishedEndpoints

Gets the endpoint collection for the organization you are connected to.

System_CAPS_pubpropertyConnectedOrgUniqueName

Get the unique name of the organization you are connected to.

System_CAPS_pubpropertyConnectedOrgVersion

Gets the version number of the organization you are connected to. If accessed before you are connected to an organization, null or 0.0 is returned.

System_CAPS_pubpropertyConnectionLockObject

Gets the connection lock object that is used to control connection access for various threads. This should be used to lock the connection if you are using the Microsoft Dynamics CRM queries via LINQ.

System_CAPS_pubpropertyCrmConnectOrgUriActual

Gets the actual URI used to connect to Microsoft Dynamics CRM. This URI could be influenced by user defined variables.

System_CAPS_pubpropertyIsBatchOperationsAvailable

Gets information about the availability of batch operation. If true, batch operations are available.

System_CAPS_pubpropertyIsReady

Gets the service connection status. If true, the service is ready to accept requests.

System_CAPS_pubpropertyLastCrmError

Gets the last error that occurred while attempting to connect to Microsoft Dynamics CRM.

System_CAPS_pubpropertyLastCrmException

Gets the last exception that occurred while attempting to connect to Microsoft Dynamics CRM.

System_CAPS_pubpropertyOAuthUserId

Gets the current user ID used for connecting to CRM using OAuth.

System_CAPS_pubpropertyOrganizationServiceProxy

Gets the native Microsoft Dynamics CRM organization service.

System_CAPS_pubpropertyOrganizationWebProxyClient

Gets the CRM OrganizationWebProxyClient instance for the active CRM connection using OAuth.

System_CAPS_pubpropertySdkVersionProperty

NameDescription
System_CAPS_pubmethodAddEntityToQueue(Guid, String, String, Guid, Boolean, Guid)

Route an entity to a public queue.

System_CAPS_pubmethodAssignEntityToUser(Guid, String, Guid, Guid)

Assign an Entity to the specified user ID

System_CAPS_pubmethodAssociate(String, Guid, Relationship, EntityReferenceCollection)

System_CAPS_pubmethodCancelSalesOrder(Guid, Dictionary<String, CrmDataTypeWrapper>, Int32, Guid)

Cancel Sales order

System_CAPS_pubmethodCloseActivity(String, Guid, String, String, Guid)

Closes the Activity type specified. The Activity Entity type supports fax , letter , and phonecall

*Note: This will default to using English names for Status. if you need to use Non-English, you should populate the names for completed for the status and state.

System_CAPS_pubmethodCloseIncident(Guid, Dictionary<String, CrmDataTypeWrapper>, Int32, Guid)

Closes an Incident request in CRM, this special handling is necessary to support CRM Built In Object.

System_CAPS_pubmethodCloseOpportunity(Guid, Dictionary<String, CrmDataTypeWrapper>, Int32, Guid)

This will close an opportunity as either Won or lost in CRM

System_CAPS_pubmethodCloseQuote(Guid, Dictionary<String, CrmDataTypeWrapper>, Int32, Guid)

Closes a quote as won or lost, Revise is not supported via this method

System_CAPS_pubmethodCloseTroubleTicket(Guid, String, String, Guid)

Closes a Trouble ticket by ID

System_CAPS_pubmethodCreate(Entity)

System_CAPS_pubmethodCreateAnnotation(String, Guid, Dictionary<String, CrmDataTypeWrapper>, Guid)

This creates a annotation [note] entry, related to a an existing entity

Required Properties in the fieldList

notetext (string) = Text of the note,

subject (string) = this is the title of the note

System_CAPS_pubmethodCreateBatchOperationRequest(String, Boolean, Boolean)

Creates a batch request for executing batch operations. This method returns an ID (GUID) that will be used to identify a request as a batch request vs a "normal" request.

System_CAPS_pubmethodCreateEntityAssociation(String, Guid, String, Guid, String, Guid)

Associates one Entity to another where an M2M Relationship Exists.

System_CAPS_pubmethodCreateMultiEntityAssociation(String, Guid, String, List<Guid>, String, Guid, Boolean)

Associates multiple entities of the same time to a single entity

System_CAPS_pubmethodCreateNewActivityEntry(String, String, Guid, String, String, String, Dictionary<String, CrmDataTypeWrapper>, Guid)

Creates a new activity against the target entity type

System_CAPS_pubmethodCreateNewRecord(String, Dictionary<String, CrmDataTypeWrapper>, String, Boolean, Guid)

Uses the dynamic entity pattern to create a new entity record.

System_CAPS_pubmethodCreateOrUpdatePickListElement(String, String, List<LocalizedLabel>, Int32, Boolean)

Adds an option to a pick list on an entity.

System_CAPS_pubmethodDelete(String, Guid)

System_CAPS_pubmethodDeleteEntity(String, Guid, Guid)

Deletes an entity from the CRM

System_CAPS_pubmethodDeleteEntityAssociation(String, Guid, String, Guid, String, Guid)

Removes the Association between 2 entity items where an M2M Relationship Exists.

System_CAPS_pubmethodDisassociate(String, Guid, Relationship, EntityReferenceCollection)

System_CAPS_pubmethodSystem_CAPS_staticDiscoverOrganizations(Uri, ClientCredentials, UserIdentifier, String, Uri, String, Boolean, String, PromptBehavior)

System_CAPS_pubmethodSystem_CAPS_staticDiscoverOrganizations(Uri, Uri, ClientCredentials, ClientCredentials)

Discovers the organizations.

System_CAPS_pubmethodSystem_CAPS_staticDiscoverOrganizations(Uri, Uri, NetworkCredential)

Discovers the organizations.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodExecute(OrganizationRequest)

System_CAPS_pubmethodExecuteBatch(Guid)

Begins running the Batch command.

System_CAPS_pubmethodExecuteCrmEntityDeleteRequest(String, Guid, String)

Executes a row level delete on a CRM entity ( thread safe ) and returns true or false. Also adds metrics for logging support.

System_CAPS_pubmethodExecuteCrmOrganizationRequest(OrganizationRequest, String)

Executes a CRM Organization Request (thread safe) and returns the organization response object. Also adds metrics for logging support.

System_CAPS_pubmethodExecuteWorkflowOnEntity(String, Guid, Guid)

Executes a named workflow on an object.

System_CAPS_pubmethodGetActivitiesBy(String, Guid, List<String>, CrmServiceClient.LogicalSearchOperator, Dictionary<String, String>, Dictionary<String, CrmServiceClient.LogicalSortOrder>, Int32, Int32, String, String, Boolean, Guid)

Returns all Activities Related to a given Entity ID. Only Account, Contact and Opportunity entities are supported.

System_CAPS_pubmethodGetActivitiesBy(String, Guid, List<String>, CrmServiceClient.LogicalSearchOperator, List<CrmServiceClient.CrmSearchFilter>, Dictionary<String, CrmServiceClient.LogicalSortOrder>, Int32, Int32, String, String, Boolean, Guid)

Returns all Activities Related to a given Entity ID. Only Account, Contact and Opportunity entities are supported.

System_CAPS_pubmethodGetAllAttributesForEntity(String)

Returns all attributes on a entity

System_CAPS_pubmethodGetAllEntityMetadata(Boolean, EntityFilters)

Returns a list of entities with basic data from CRM

System_CAPS_pubmethodGetBatchById(Guid)

TEMP

System_CAPS_pubmethodGetBatchOperationIdRequestByName(String)

Returns the batch id for a given batch name.

System_CAPS_pubmethodGetBatchRequestAtPosition(Guid, Int32)

Returns the organization request at a give position

System_CAPS_pubmethodGetDataByKeyFromResultsSet<T>(Dictionary<String, Object>, String)

This function gets data from a Dictionary object, where "string" identifies the field name, and Object contains the data, this method then attempts to cast the result to the Type requested, if it cannot be cast an empty object is returned.

System_CAPS_pubmethodGetEntityAttributeMetadataForAttribute(String, String)

Gets metadata for a specific entity's attribute.

System_CAPS_pubmethodGetEntityDataByFetchSearch(String, Guid)

Searches for data based on a FetchXML query

System_CAPS_pubmethodGetEntityDataByFetchSearch(String, Int32, Int32, String, String, Boolean, Guid)

Searches for data based on a FetchXML query

System_CAPS_pubmethodGetEntityDataByFetchSearchEC(String, Guid)

Searches for data based on a FetchXML query

System_CAPS_pubmethodGetEntityDataByFetchSearchEC(String, Int32, Int32, String, String, Boolean, Guid)

Searches for data based on a FetchXML query

System_CAPS_pubmethodGetEntityDataById(String, Guid, List<String>, Guid)

Gets a List of variables from the account based on the list of field specified in the Fields List

System_CAPS_pubmethodGetEntityDataByLinkedSearch(String, Dictionary<String, String>, String, Dictionary<String, String>, String, String, String, CrmServiceClient.LogicalSearchOperator, List<String>, Guid)

Queries an Object via a M to M Link

System_CAPS_pubmethodGetEntityDataByLinkedSearch(String, List<CrmServiceClient.CrmSearchFilter>, String, List<CrmServiceClient.CrmSearchFilter>, String, String, String, CrmServiceClient.LogicalSearchOperator, List<String>, Guid, Boolean)

Queries an Object via a M to M Link

System_CAPS_pubmethodGetEntityDataByRollup(String, Guid, String, List<String>, CrmServiceClient.LogicalSearchOperator, Dictionary<String, String>, Dictionary<String, CrmServiceClient.LogicalSortOrder>, Guid)

Returns all Activities Related to a given Entity ID. Only Account, Contact and Opportunity entities are supported.

System_CAPS_pubmethodGetEntityDataByRollup(String, Guid, String, List<String>, CrmServiceClient.LogicalSearchOperator, List<CrmServiceClient.CrmSearchFilter>, Dictionary<String, CrmServiceClient.LogicalSortOrder>, Int32, Int32, String, String, Boolean, Guid)

Returns all Activities Related to a given Entity ID. Only Account, Contact and Opportunity entities are supported.

System_CAPS_pubmethodGetEntityDataBySearchParams(String, Dictionary<String, String>, CrmServiceClient.LogicalSearchOperator, List<String>, Guid)

Gets a list of accounts based on the search parameters.

System_CAPS_pubmethodGetEntityDataBySearchParams(String, List<CrmServiceClient.CrmSearchFilter>, CrmServiceClient.LogicalSearchOperator, List<String>, Dictionary<String, CrmServiceClient.LogicalSortOrder>, Int32, Int32, String, String, Boolean, Guid)

Searches for data from an entity based on the search parameters.

System_CAPS_pubmethodGetEntityDataBySearchParams(String, List<CrmServiceClient.CrmSearchFilter>, CrmServiceClient.LogicalSearchOperator, List<String>, Guid)

Gets a list of accounts based on the search parameters.

System_CAPS_pubmethodGetEntityDisplayName(String, Int32)

Gets an Entity Name by Logical name or Type code.

System_CAPS_pubmethodGetEntityDisplayNamePlural(String, Int32)

Gets an Entity Name by Logical name or Type code.

System_CAPS_pubmethodGetEntityFormIdListByType(String, CrmServiceClient.FormTypeId)

Returns the Form Entity References for a given form type.

System_CAPS_pubmethodGetEntityMetadata(String, EntityFilters)

Returns the Metadata for an entity from CRM, defaults to basic data only.

System_CAPS_pubmethodGetEntityName(Int32)

Returns the Entity name for the given Type code

System_CAPS_pubmethodGetEntityTypeCode(String)

Gets the typecode of an entity by name.

System_CAPS_pubmethodGetGlobalOptionSetMetadata(String)

Gets a global option set from CRM.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetMyCrmUserId()

Gets the user ID of the currently logged in user.

System_CAPS_pubmethodGetPickListElementFromMetadataEntity(String, String)

Gets a PickList, Status List or StateList from the metadata of an attribute

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodImportDataMapToCrm(String, Boolean, Boolean)

Used to upload a data map to the CRM

System_CAPS_pubmethodImportSolutionToCrm(String, Guid, Boolean, Boolean, Boolean, Boolean)

System_CAPS_pubmethodInstallSampleDataToCrm()

Request CRM to install sample data shipped with CRM. Note this is process will take a few moments to execute.

This method will return once the request has been submitted.

System_CAPS_pubmethodIsSampleDataInstalled()

Determines if the CRM sample data has been installed

System_CAPS_pubmethodSystem_CAPS_staticMakeSecureString(String)

Makes a secure string

System_CAPS_pubmethodPublishEntity(String)

Publishes an entity to the production system, used in conjunction with the Metadata services.

System_CAPS_pubmethodReleaseBatchInfoById(Guid)

Release a batch from the stack Once you have completed using a batch, you must release it from the system.

System_CAPS_pubmethodSystem_CAPS_staticRemoveOAuthTokenCache(String)

System_CAPS_pubmethodResetLocalMetadataCache(String)

This will clear the Metadata cache for either all entities or the specified entity

System_CAPS_pubmethodRetrieve(String, Guid, ColumnSet)

System_CAPS_pubmethodRetrieveBatchResponse(Guid)

System_CAPS_pubmethodRetrieveMultiple(QueryBase)

System_CAPS_pubmethodSendSingleEmail(Guid, String, Guid)

Sends an email.

System_CAPS_pubmethodSubmitImportRequest(CrmServiceClient.ImportRequest, DateTime)

Starts an Import request for CRM.

Supports a single file per Import request.

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodUninstallSampleDataFromCrm()

Request CRM to remove sample data shipped with CRM. Note this is process will take a few moments to execute. This method will return once the request has been submitted.

System_CAPS_pubmethodUpdate(Entity)

System_CAPS_pubmethodUpdateEntity(String, String, Guid, Dictionary<String, CrmDataTypeWrapper>, String, Boolean, Guid)

Generic update entity

System_CAPS_pubmethodUpdateStateAndStatusForEntity(String, Guid, Int32, Int32, Guid)

Updates the State and Status of the Entity passed in.

System_CAPS_pubmethodUpdateStateAndStatusForEntity(String, Guid, String, String, Guid)

Updates the State and Status of the Entity passed in.

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright

Community Additions

Show: