Share via


CrmServiceClient Class

 

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)

Inheritance Hierarchy

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

Syntax

public sealed class CrmServiceClient : IOrganizationService
Public NotInheritable Class CrmServiceClient
    Implements IOrganizationService

Constructors

Name Description
System_CAPS_pubmethod CrmServiceClient(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_pubmethod CrmServiceClient(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_pubmethod CrmServiceClient(OrganizationServiceProxy)

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

System_CAPS_pubmethod CrmServiceClient(OrganizationWebProxyClient)

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

System_CAPS_pubmethod CrmServiceClient(String)

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

System_CAPS_pubmethod CrmServiceClient(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_pubmethod CrmServiceClient(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_pubmethod CrmServiceClient(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_pubmethod CrmServiceClient(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.

Properties

Name Description
System_CAPS_pubproperty ActiveAuthenticationType

Gets the authentication type used for the active CRM connection.

System_CAPS_pubproperty Authority

System_CAPS_pubproperty CallerId

System_CAPS_pubproperty ConnectedOrgFriendlyName

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

System_CAPS_pubproperty ConnectedOrgPublishedEndpoints

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

System_CAPS_pubproperty ConnectedOrgUniqueName

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

System_CAPS_pubproperty ConnectedOrgVersion

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_pubproperty ConnectionLockObject

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_pubproperty CrmConnectOrgUriActual

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

System_CAPS_pubproperty IsBatchOperationsAvailable

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

System_CAPS_pubproperty IsReady

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

System_CAPS_pubproperty LastCrmError

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

System_CAPS_pubproperty LastCrmException

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

System_CAPS_pubproperty OAuthUserId

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

System_CAPS_pubproperty OrganizationServiceProxy

Gets the native Microsoft Dynamics CRM organization service.

System_CAPS_pubproperty OrganizationWebProxyClient

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

System_CAPS_pubproperty SdkVersionProperty

Methods

Name Description
System_CAPS_pubmethod AddEntityToQueue(Guid, String, String, Guid, Boolean, Guid)

Route an entity to a public queue.

System_CAPS_pubmethod AssignEntityToUser(Guid, String, Guid, Guid)

Assign an Entity to the specified user ID

System_CAPS_pubmethod Associate(String, Guid, Relationship, EntityReferenceCollection)

System_CAPS_pubmethod CancelSalesOrder(Guid, Dictionary<String, CrmDataTypeWrapper>, Int32, Guid)

Cancel Sales order

System_CAPS_pubmethod CloseActivity(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_pubmethod CloseIncident(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_pubmethod CloseOpportunity(Guid, Dictionary<String, CrmDataTypeWrapper>, Int32, Guid)

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

System_CAPS_pubmethod CloseQuote(Guid, Dictionary<String, CrmDataTypeWrapper>, Int32, Guid)

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

System_CAPS_pubmethod CloseTroubleTicket(Guid, String, String, Guid)

Closes a Trouble ticket by ID

System_CAPS_pubmethod Create(Entity)

System_CAPS_pubmethod CreateAnnotation(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_pubmethod CreateBatchOperationRequest(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_pubmethod CreateEntityAssociation(String, Guid, String, Guid, String, Guid)

Associates one Entity to another where an M2M Relationship Exists.

System_CAPS_pubmethod CreateMultiEntityAssociation(String, Guid, String, List<Guid>, String, Guid, Boolean)

Associates multiple entities of the same time to a single entity

System_CAPS_pubmethod CreateNewActivityEntry(String, String, Guid, String, String, String, Dictionary<String, CrmDataTypeWrapper>, Guid)

Creates a new activity against the target entity type

System_CAPS_pubmethod CreateNewRecord(String, Dictionary<String, CrmDataTypeWrapper>, String, Boolean, Guid)

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

System_CAPS_pubmethod CreateOrUpdatePickListElement(String, String, List<LocalizedLabel>, Int32, Boolean)

Adds an option to a pick list on an entity.

System_CAPS_pubmethod Delete(String, Guid)

System_CAPS_pubmethod DeleteEntity(String, Guid, Guid)

Deletes an entity from the CRM

System_CAPS_pubmethod DeleteEntityAssociation(String, Guid, String, Guid, String, Guid)

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

System_CAPS_pubmethod Disassociate(String, Guid, Relationship, EntityReferenceCollection)

System_CAPS_pubmethodSystem_CAPS_static DiscoverOrganizations(Uri, ClientCredentials, UserIdentifier, String, Uri, String, Boolean, String, PromptBehavior)

System_CAPS_pubmethodSystem_CAPS_static DiscoverOrganizations(Uri, Uri, ClientCredentials, ClientCredentials)

Discovers the organizations.

System_CAPS_pubmethodSystem_CAPS_static DiscoverOrganizations(Uri, Uri, NetworkCredential)

Discovers the organizations.

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod Execute(OrganizationRequest)

System_CAPS_pubmethod ExecuteBatch(Guid)

Begins running the Batch command.

System_CAPS_pubmethod ExecuteCrmEntityDeleteRequest(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_pubmethod ExecuteCrmOrganizationRequest(OrganizationRequest, String)

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

System_CAPS_pubmethod ExecuteWorkflowOnEntity(String, Guid, Guid)

Executes a named workflow on an object.

System_CAPS_pubmethod GetActivitiesBy(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_pubmethod GetActivitiesBy(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_pubmethod GetAllAttributesForEntity(String)

Returns all attributes on a entity

System_CAPS_pubmethod GetAllEntityMetadata(Boolean, EntityFilters)

Returns a list of entities with basic data from CRM

System_CAPS_pubmethod GetBatchById(Guid)

TEMP

System_CAPS_pubmethod GetBatchOperationIdRequestByName(String)

Returns the batch id for a given batch name.

System_CAPS_pubmethod GetBatchRequestAtPosition(Guid, Int32)

Returns the organization request at a give position

System_CAPS_pubmethod GetDataByKeyFromResultsSet<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_pubmethod GetEntityAttributeMetadataForAttribute(String, String)

Gets metadata for a specific entity's attribute.

System_CAPS_pubmethod GetEntityDataByFetchSearch(String, Guid)

Searches for data based on a FetchXML query

System_CAPS_pubmethod GetEntityDataByFetchSearch(String, Int32, Int32, String, String, Boolean, Guid)

Searches for data based on a FetchXML query

System_CAPS_pubmethod GetEntityDataByFetchSearchEC(String, Guid)

Searches for data based on a FetchXML query

System_CAPS_pubmethod GetEntityDataByFetchSearchEC(String, Int32, Int32, String, String, Boolean, Guid)

Searches for data based on a FetchXML query

System_CAPS_pubmethod GetEntityDataById(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_pubmethod GetEntityDataByLinkedSearch(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_pubmethod GetEntityDataByLinkedSearch(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_pubmethod GetEntityDataByRollup(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_pubmethod GetEntityDataByRollup(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_pubmethod GetEntityDataBySearchParams(String, Dictionary<String, String>, CrmServiceClient.LogicalSearchOperator, List<String>, Guid)

Gets a list of accounts based on the search parameters.

System_CAPS_pubmethod GetEntityDataBySearchParams(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_pubmethod GetEntityDataBySearchParams(String, List<CrmServiceClient.CrmSearchFilter>, CrmServiceClient.LogicalSearchOperator, List<String>, Guid)

Gets a list of accounts based on the search parameters.

System_CAPS_pubmethod GetEntityDisplayName(String, Int32)

Gets an Entity Name by Logical name or Type code.

System_CAPS_pubmethod GetEntityDisplayNamePlural(String, Int32)

Gets an Entity Name by Logical name or Type code.

System_CAPS_pubmethod GetEntityFormIdListByType(String, CrmServiceClient.FormTypeId)

Returns the Form Entity References for a given form type.

System_CAPS_pubmethod GetEntityMetadata(String, EntityFilters)

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

System_CAPS_pubmethod GetEntityName(Int32)

Returns the Entity name for the given Type code

System_CAPS_pubmethod GetEntityTypeCode(String)

Gets the typecode of an entity by name.

System_CAPS_pubmethod GetGlobalOptionSetMetadata(String)

Gets a global option set from CRM.

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetMyCrmUserId()

Gets the user ID of the currently logged in user.

System_CAPS_pubmethod GetPickListElementFromMetadataEntity(String, String)

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

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod ImportDataMapToCrm(String, Boolean, Boolean)

Used to upload a data map to the CRM

System_CAPS_pubmethod ImportSolutionToCrm(String, Guid, Boolean, Boolean, Boolean, Boolean)

System_CAPS_pubmethod InstallSampleDataToCrm()

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_pubmethod IsSampleDataInstalled()

Determines if the CRM sample data has been installed

System_CAPS_pubmethodSystem_CAPS_static MakeSecureString(String)

Makes a secure string

System_CAPS_pubmethod PublishEntity(String)

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

System_CAPS_pubmethod ReleaseBatchInfoById(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_static RemoveOAuthTokenCache(String)

System_CAPS_pubmethod ResetLocalMetadataCache(String)

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

System_CAPS_pubmethod Retrieve(String, Guid, ColumnSet)

System_CAPS_pubmethod RetrieveBatchResponse(Guid)

System_CAPS_pubmethod RetrieveMultiple(QueryBase)

System_CAPS_pubmethod SendSingleEmail(Guid, String, Guid)

Sends an email.

System_CAPS_pubmethod SubmitImportRequest(CrmServiceClient.ImportRequest, DateTime)

Starts an Import request for CRM.

Supports a single file per Import request.

System_CAPS_pubmethod ToString()

(Inherited from Object.)

System_CAPS_pubmethod UninstallSampleDataFromCrm()

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_pubmethod Update(Entity)

System_CAPS_pubmethod UpdateEntity(String, String, Guid, Dictionary<String, CrmDataTypeWrapper>, String, Boolean, Guid)

Generic update entity

System_CAPS_pubmethod UpdateStateAndStatusForEntity(String, Guid, Int32, Int32, Guid)

Updates the State and Status of the Entity passed in.

System_CAPS_pubmethod UpdateStateAndStatusForEntity(String, Guid, String, String, Guid)

Updates the State and Status of the Entity passed in.

Thread Safety

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

See Also

Microsoft.Xrm.Tooling.Connector Namespace
Build Windows client applications using the XRM tools

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright