C# 在CRM C中创建帐户的联系人绑定#

C# 在CRM C中创建帐户的联系人绑定#,c#,sdk,dynamics-crm,crm,C#,Sdk,Dynamics Crm,Crm,我不知道如何创建绑定到帐户的联系人。我有一个带有帐户和联系人的csv文件,我想将此数据导入我的CRM。这是我将帐户添加到CRM的代码: #region Column One Mappings // Create a column mapping for a 'text' type field. Ajouter un Compte ColumnMapping colMapping1 = new ColumnMapping() { // Set source properties.

我不知道如何创建绑定到帐户的联系人。我有一个带有帐户和联系人的csv文件,我想将此数据导入我的CRM。这是我将帐户添加到CRM的代码:

#region Column One Mappings
// Create a column mapping for a 'text' type field. Ajouter un Compte
ColumnMapping colMapping1 = new ColumnMapping()
{
    // Set source properties.
    SourceAttributeName = "my_new_accounts",
    SourceEntityName = "Account_1",

    // Set target properties.
    TargetAttributeName = "name",
    TargetEntityName = Account.EntityLogicalName,

    // Relate this column mapping with the data map.
    ImportMapId = new EntityReference(ImportMap.EntityLogicalName, importMapId),

    // Force this column to be processed.
    ProcessCode = new OptionSetValue((int)ColumnMappingProcessCode.Process)
};

// Create the mapping.
Guid colMappingId1 = _serviceProxy.Create(colMapping1);
#endregion

我想创建多个绑定到一个帐户的联系人。

您使用的示例代码来自,同一示例还包含用于映射父帐户查找映射的代码

 // Create a lookup mapping to the parent account.  
        LookUpMapping parentLookupMapping = new LookUpMapping().........
查看此代码块,阅读注释,根据需要实现它


如果您只是在试验这种方法,请继续。或者您可以使用OOB数据导入向导简单地导入。

您使用的示例代码来自,同一示例还包含用于映射父帐户查找映射的代码

 // Create a lookup mapping to the parent account.  
        LookUpMapping parentLookupMapping = new LookUpMapping().........
查看此代码块,阅读注释,根据需要实现它

如果您只是在试验这种方法,请继续。或者您可以使用OOB数据导入向导简单地导入