Retrieving a list of associations

This sample demonstrates how to retrieve and update a list of associated entities given a specific entity.

/// <summary>

/// Retrieves an array of Contact-Contact associations for the given contact

/// and updates the association information.

/// </summary>

private void UpdateAssociatons(Contact contact,string newRole)

{

//Log into the framework and retrive the correct AssociationManager

ActFramework ACTFM = new ActFramework();

ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman", "");

AssociationManager associationManager = ACTFM.Associations.GetAssociationManager("Group", "Opportunity");

//Retrieve the associations for the passed in contact.

Association[] associations = associationManager.GetAssociations(contact);

foreach (Association association in associations)

{

//Update the associaton.

association.Fields[StandardField.Entity1Role] = newRole;

association.Update();

}

}