I'm trying to associate a center with a contact. There exists a many to many relationship between contact and center named "tle_contact_tle_center";
I tried the following two ways to achieve this but none of them worked.
Any help in this regard would be appreciated.
1)
AssociateRequest request = new AssociateRequest { Target = new EntityReference("contact", contactId), Relationship = new Relationship("tle_contact_tle_center"), RelatedEntities = new EntityReferenceCollection { new EntityReference("tle_center",centerId) } }; service.Execute(request);
2)
EntityReferenceCollection relatedEntities = new EntityReferenceCollection(); relatedEntities.Add(new EntityReference("tle_center", centerId)); // Create an object that defines the relationship between the contact and center. Relationship relationship = new Relationship("tle_contact_tle_center"); //Associate the center with the contact service.Associate("contact", contactId, relationship, relatedEntities);
*This post is locked for comments