Getting custom contact fields

This sample retrieves names of the custom contact fields and puts them into an Array list. The sample shows the following tasks:

/// <summary>

/// Retrieves names of all contact custom fields from the Act! Database

/// </summary>

/// <returns>Array list with names of the custom fields</returns>

public override ArrayList GetContactCustomFields()

{

ActFramework ACTFM = new ActFramework();

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

SchemaMetaData smd = ACTFM.SchemaMetaData; ReadOnlyHashtable tblByName = smd.TableByName; ArrayList customFieldArray = new ArrayList();

ContactFieldDescriptor[] cfdList = ACTFM.Contacts.GetContactFieldDescriptors();

ContactFieldDescriptor cfd;

Table tContact = null;

Column col;

for(int i=0; i < cfdList.Length; i++)

{
cfd = cfdList[i];
tContact = (Act.Framework.MetaData.Table) tblByName[cfd.TableName];
col = (Column)tContact.ColumnByDisplayName[cfd.DisplayName];
if( col != null )
{
if( col.IsCustom ) customFieldArray.Add( col.Name );
}
}
return customFieldArray;

}