CRM2011 Creating Many to Many relationshios via C#

Creating Many to Many relationshios via C#

  
EntityCollection eBarrera;
eBarreraC = getCond(barrera);

GestionGUID.GuidCondicionantes = new Guid(eBarreraC.Entities[0].Id.ToString());

string strManyToManyRelationshipName = "chm_chm_cond_contact";

AssociateEntitiesRequest request = new AssociateEntitiesRequest();
request.Moniker1 = new EntityReference { Id = idAseg, LogicalName = "contact" };
request.Moniker2 = new EntityReference { Id = GestionGUID.GuidCon, LogicalName = "chm_con" };
request.RelationshipName = strManyToManyRelationshipName;
servicio.Execute(request);

Advertisements

One thought on “CRM2011 Creating Many to Many relationshios via C#

  1. csharpsql

    I just did this another way:

    Relationship relationship = new Relationship(“relationshipName”);
    context.AddLink(entity1, relationship, entity2);

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s