Tags: 
API, Dynamics CRM

Overview

These public interfaces are used in Dynamics CRM components. They are provided for implementing advanced functionality in your scripts. In order for you to use these interfaces in your project, you have to reference CozyRoc.SSISPlus.dll and CozyRoc.Dynamics.dll libraries. Also include CozyRoc.Dynamics.Crm, CozyRoc.Dynamics.Crm.Service, CozyRoc.Dynamics.Crm.MetadataService, CozyRoc.Dynamics.Crm.DiscoveryService namespaces.


IConnection / ICrmConnection

When you call Dynamics CRM Connection Manager AcquireConnection method, it returns object implementing IConnection interface. This is the interface used for interaction with Dynamics CRM service.

Methods

Connects to Dynamics CRM service.

Closes the connection to Dynamics CRM service. Use always after you finish working with the service.

Returns true if connected to the service.

Get specific Dynamics CRM web service. These are the method parameters:

  • service (int) - service type. It can be one of the options listed in the following table.
    Value Result Service
    0
    • CRM 2011 - returns service class from CozyRoc.Dynamics.Crm2011.OrganizationService namespace
    • CRM 4.0 - returns CrmService class from CozyRoc.Dynamics.Crm.Service namespace.
    • CRM 3.0 - returns service class from CozyRoc.Dynamics.Crm3.Service namespace.
    1
    • CRM 2011 - Not available.
    • CRM 4.0 - returns MetadataService class from CozyRoc.Dynamics.Crm.MetadataService namespace.
    • CRM 3.0 - returns service class from CozyRoc.Dynamics.Crm3.MetadataService namespace.
    2
    • CRM 2011 - returns service class from CozyRoc.Dynamics.Crm2011.DiscoveryService namespace.
    • CRM 4.0 - returns CrmDiscoveryService class from CozyRoc.Dynamics.Crm.DiscoveryService namespace.
    • CRM 3.0 - Not available.

Gets organizations list.

Gets entities list with specific privilege. These are the method parameters:

  • privilege (int) - entity privilege. It can be one of the options listed in the following table.
    Value Description
    0 Privilege unspecified. All entities will be returned.
    1 Return entities, which permit record creation.
    2 Return entities, which can be read.
    3 Return entities, which can be updated.
    4 Return entities, which permit record removal.

Query Dynamics CRM service. The method returns XML string with the result of the query. These are the method parameters:

  • fetchXML (string) FetchXML query statement.

DEPRECATED: Use IEntity.GetAttributes method instead.

Get entity attributes. The method returns array of IAttribute objects. These are the method parameters:

  • entity (string) - entity name.

Get attributes specified in query. The method returns array of IAttribute objects. These are the method parameters:

  • fetchXML (string) - FetchXML query statement.

DEPRECATED: Use GetEntity method instead.

Construct object, which will be used to manipulate entity. The method returns ICrmEntity object. These are the method parameters:

  • name (string) - entity name.

DEPRECATED: Use IEntity interface instead.

Creates record in entity. The method returns string with identifier of the created record. These are the method parameters:

  • entity (ICrmEntity) - object with create data.
  • ignoreMissingId - specify to ignore attributes referencing missing data.
  • detectDuplicate - specify to enable duplicate detection rule.

DEPRECATED: Use IEntity interface instead.

Updates existing record in entity. These are the method parameters:

  • entity (ICrmEntity) - object with update data.
  • ignoreMissingId - specify to ignore attributes referencing missing data.
  • detectDuplicate - specify to enable duplicate detection rule.

DEPRECATED: Use IEntity interface instead.

Deletes record in entity. These are the method parameters:

DEPRECATED: Use IEntity interface instead.

Update and insert a record in destination entity. These are the method parameters:

  • entity (ICrmEntity) - object with update data.
  • ignoreMissingId - specify to ignore attributes referencing missing data.

Get object used to manage Dynamics CRM entity. The method returns IEntity object. These are the method parameters:

  • name (string) - entity name.

Properties

Specify deployment type. This property has the options listed in the following table.

Value Description
0 Connect to on-premise Dynamics CRM server.
1 Connect to Dynamics CRM Live service.
2 Connect to hosted Dynamics CRM.
3 Connect to Dynamics CRM 3.0 system.
4 Connect to Dynamics CRM 2011 web services 1.6.

Specify the name or IP address of the Dynamics CRM server.

Specify user name to access the Dynamics CRM service.

Specify user password to access the Dynamics CRM service.

Specify organization name. Note: Not available in CRM 3.0

Specify the number of seconds before timing out session connect. The default value of this property is 100 seconds.

Specify if all clients should use the same connection. This property has the options listed in the following table.

Value Description
True All clients use same connection (default).
False Every client uses different connection.

Specify the name or IP address of the proxy server.

Specify the port number on the proxy server to use for the connection.

Specify user name to access the proxy server.

Specify password to access the proxy server.


IAttribute / ICrmAttribute

This interface is used to retrieve entity attributes information.

Properties

Returns attribute name.

Returns true if attribute can be read.

Returns true if attribute can be specified for record creation.

Returns true if attribute can be specified for record update.

Returns true if attribute is primary key.

Returns SSIS attribute type.

Returns attribute entity reference if attribute is lookup.

Returns internal AttributeMetadata object.

Returns attribute type. It can be one of the options listed in the following table.

CRM 3.0, CRM 4.0

ValueDescription
0Boolean
1Customer
2DateTime
3Decimal
4Float
5Integer
6Internal
7Lookup
8Memo
9Money
10Owner
11PartyList
12Picklist
13PrimaryKey
14State
15Status
16String
17UniqueIdentifier
18Virtual
19CalendarRules

CRM 2011

ValueDescription
0Boolean
1Customer
2DateTime
3Decimal
4Double
5Integer
6Lookup
7Memo
8Money
9Owner
10PartyList
11Picklist
12State
13Status
14String
15UniqueIdentifier
16CalendarRules
17Virtual
18BigInt
19ManagedProperty
20EntityName

Returns attribute length.

Returns attribute precision.

Returns attribute scale.


ICrmEntity

DEPRECATED: Use IEntity interface instead.

This interface is used to manipulate entity record.

Methods

Adds attribute. The method returns the index of the newly inserted attribute. These are the method parameters:

  • name (string) - attribute name.
  • attributeType (int) - attribute type. For valid values check CrmType property in IAttribute interface.
  • reference (string) - entity reference. Only used when dealing with lookup attributes.

Return count of attributes.

Sets attribute value. These are the method parameters:

  • index (int) - attribute index.
  • value (object) - attribute value.

Returns attribute value. These are the method parameters:

  • index (int) - attribute index.

Constructs DynamicEntity object.


Properties

Returns the entity name this object is associated with.


IEntity / ICrmEntity2 1.6 SR-1

This interface is used to manipulate entity record.

Methods

Get entity attributes. The method returns array of IAttribute objects.

Constructs new Dynamics CRM entity data instance.

Sets attribute value in entity instance. These are the method parameters:

  • entity (object) - entity instance.
  • name (string) - attribute name.
  • value (object) - attribute value.

Returns attribute value from entity instance. These are the method parameters:

  • entity (object) - entity instance.
  • name (string) - attribute name.

Creates records in entity. The method returns array of IStatus objects for each input object. These are the method parameters:

  • list (object array) - array of Dynamics CRM entities to create.
  • ignoreMissingId - specify to ignore attributes referencing missing data.
  • detectDuplicate - specify to enable duplicate detection rule.

Updates existing records in entity. The method returns array of IStatus objects for each input object. These are the method parameters:

  • list (object array) - array of Dynamics CRM entities with update data.
  • ignoreMissingId - specify to ignore attributes referencing missing data.
  • detectDuplicate - specify to enable duplicate detection rule.

Create records and update existing records in entity. The method returns array of IStatus objects for each input object. These are the method parameters:

  • list (object array) - array of Dynamics CRM entities with create and update data.
  • ignoreMissingId - specify to ignore attributes referencing missing data.

Delete existing records in entity. The method returns array of IStatus objects for each input object. These are the method parameters:

  • list (object array) - array of Dynamics CRM entities to delete.

IStatus / ICrmStatus 1.6 SR-1

This interface is used for reporting back status.

Properties

Returns the Dynamics CRM entity identifier.

Returns the Dynamics CRM error code. If zero, there is no error.

Returns the Dynamics CRM status message.


Related documentation