Link.Load Method
The Link method updates the IntegrationEntityInstance and IntegrationEntityInstanceLink tables with entities and links gathered from the specified XML string. This method is used to perform the linking for the initial migration or bulk load of data.
Syntax
[Visual Basic .NET]
Public Sub Load(
ByVal LinkList As String,
ByRef LinkResults As String
)
[C#]
public void Load(
string LinkList,
ref string LinkResults
);
[C++]
public: void Load(
String* LinkList,
String** LinkResults
);
Parameters
LinkList
Specifies either the path to an XML file or an XML string. The file or string contains the data about all desired EntityInstances and EntityInstanceLinks.
LinkResults
[ref] An XML stream containing any errors that occur during processing as well as the Entity that failed.
Return Value
No return value.
Example
The input may be either a path to the XML file, or the XML stream itself.
Load("C:\InputFile.xml", stringForOutput);
OR
String stringForInput= "<IntegrationLinks>
<IntegrationLink>
<System1>
<Name>Microsoft CRM</Name>
<EntityType>Account</EntityType>
<EntityKey>{827FEDC5A-5506-4B2C-9D48-E9168331D7D5}</EntityKey>
</System1>
<System2>
<Name>BackOfficeCompanyDB</Name>
<EntityType>Customer</EntityType>
<EntityKey>AARONFITZ0001</EntityKey>
</System2>
</IntegrationLink>
</IntegrationLinks>;
Load(stringForInput, stringForOutput);
Note The <IntegrationLink> fragment may be repeated as desired.
Sample Output
Any errors that occur due to parsing the individual <IntegrationLink> fragments or errors generated from SQL while inserting the data are returned through LinkResults in the format as follows:
<IntegrationLinkErrors>
<IntegrationLinkError>
<Message>INSERT statement conflicted with TABLE FOREIGN KEY constraint
'FK_IntegrationEntityInstance_IntegrationSystemEntity'.
The conflict occurred in database 'MSCRM Integration',
table 'IntegrationSystemEntity'.
INSERT statement conflicted with COLUMN FOREIGN KEY constraint
'FK_IntegrationEntityInstanceLink_IntegrationEntityInstance1'.
The conflict occurred in database 'MSCRM Integration',
table 'IntegrationEntityInstance', column 'IntID'.
The statement has been terminated.
The statement has been terminated.
</Message>
<FailedLink>
<IntegrationLink>
<System1>
<Name>Microsoft CRM</Name>
<EntityType>Account</EntityType>
<EntityKey>{827FEDC5A-5506-4B2C-9D48-E9168331D7D5}</EntityKey>
</System1>
<System2>
<Name>BackOfficeCompanyDB</Name>
<EntityType>Customer</EntityType>
<EntityKey>AARONFITZ0001</EntityKey>
</System2>
</IntegrationLink>
</FailedLink>
</IntegrationLinkError>
</IntegrationLinkErrors>";
Note The <IntegrationLinkError> fragment will be repeated as necessary, once per failed attempt to create a link. If an error occurs that was not due to an invalid potential link, the return data may or may not be valid XML.
Preconditions
See the preconditions for UpsertLink.
Postconditions
See the postconditions for UpsertLink.
Requirements
Namespace: Microsoft.CRM.Integration.Link
Assembly: microsoft.crm.integration.link.dll
See Also