Community
Showing results for 
Search instead for 
Do you mean 
Reply

adding secondary contact

Accepted Solution Solved
Avid Listener
Posts: 49
Country: USA
Accepted Solution

adding secondary contact

[ Edited ]

I'm trying the sample code for adding a 2ndary contact.  Here's what I have:

 

private void InsertSecordaryContact()

{

ActFramework ActFm = new ActFramework();

ActFm.LogOn("C:\\Users\\Kevin\\Documents\\ACT\\ACT Data\\Databases\\ACT2015Demo.PAD", "Chris Huffman", "");

Contact myContact = ActFm.Contacts.GetMyRecord();

ContactList secondContactList = ActFm.Contacts.GetSecondaryContacts(null, myContact);

Contact secondContact = (Contact)((lBindingList)secondContactList).AddNew();

string firstName = "Kevin";

string lastName = "Varnon";

string title = "god";

secondContact.FullName = firstName + " " + lastName;

secondContact.Fields["Contact.Title", false] = title;

secondContact.Update();

}

 

I'm using Visual Studio 2015.   I get this error:

Capture.JPG

it chokes on lBindingList on about the 7th line.  I don't know what to do; I suppose it needs another Using stmt, but I don't know what to include.`

 

 

Kevin Varnon
ClientTrax CRM
Kansas City
(785) 408-3702
kevin@clienttrax.com

Accepted Solutions
Solution
Accepted by topic author kevin319
‎01-17-2016 03:08 PM
Nickel Contributor
Posts: 175
Country: USA

Re: adding secondary contact

Well, I had to search for it, but the interface iBindingList is part of the DLL "System.ComponentModel". You'll have to include a reference for that in your project, if it's not there already.

In looking through the ObjectBrowser, since I wondered why iBindingList was even needed, I was surprised that there was no way for a MutableEntityList to add or create a new item (though I probably shouldn't have been). But it does have events for new items: AddNew and AddNewComplete. The joy of ACT programming...

View solution in original post


All Replies
Silver Super Contributor
Posts: 2,328
Country: USA

Re: adding secondary contact

You need to change the "L" in lBindingList to an "I" or iBindingList.

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Avid Listener
Posts: 49
Country: USA

Re: adding secondary contact

[ Edited ]

Well, I tried that:

namespace caWinInsert2ndContacts

{

class Program

{

static void Main(string[] args)

{

}

/// <summary>

/// Came from WinHelp Database

/// This sample inserts a secondary contact into MyRecord in an Act!database.The sample shows the following tasks:

/// •Getting MyRecord

/// •Using the SDK to retrieve the list of all secondary contacts for MyRecord.

/// •Using an implementation of IBindingList interface to add a new secondary contact to MyRecord and set properties.

/// •After adding all properties, updating the secondary contact in the Act! database*/

/// </summary>

///

private void InsertSecordaryContact()

{

ActFramework ActFm = new ActFramework();

ActFm.LogOn("C:\\Users\\Kevin\\Documents\\ACT\\ACT Data\\Databases\\ACT2015Demo.PAD", "Chris Huffman", "");

Contact myContact = ActFm.Contacts.GetMyRecord();

ContactList secondContactList = ActFm.Contacts.GetSecondaryContacts(null, myContact);

Contact secondContact = (Contact)((iBindingList)secondContactList).AddNew();

string firstName = "Kevin";

string lastName = "Varnon";

string title = "god";

secondContact.FullName = firstName + " " + lastName;

secondContact.Fields["Contact.Title", false] = title;

secondContact.Update();

}

}

}

 

And got the same error.  I tried it with a capital i also (I). 

 

Even if I get this straightened out, what then?  Where do I put the DLL?

Kevin Varnon
ClientTrax CRM
Kansas City
(785) 408-3702
kevin@clienttrax.com
Solution
Accepted by topic author kevin319
‎01-17-2016 03:08 PM
Nickel Contributor
Posts: 175
Country: USA

Re: adding secondary contact

Well, I had to search for it, but the interface iBindingList is part of the DLL "System.ComponentModel". You'll have to include a reference for that in your project, if it's not there already.

In looking through the ObjectBrowser, since I wondered why iBindingList was even needed, I was surprised that there was no way for a MutableEntityList to add or create a new item (though I probably shouldn't have been). But it does have events for new items: AddNew and AddNewComplete. The joy of ACT programming...
Avid Listener
Posts: 49
Country: USA

Re: adding secondary contact

How did you find iBindingList? Pick thru ObjectBrownser one line at a time?

Don't you need a reference to every DLL for it to be in the ObjectBrowser?
Kevin Varnon
ClientTrax CRM
Kansas City
(785) 408-3702
kevin@clienttrax.com
Nickel Contributor
Posts: 175
Country: USA

Re: adding secondary contact

Since at least Visual Studio 2008 (probably started in 2005, but I can't verify), there has been a search bar above the Namespace tree in the Object Browser. I just used that search to find iBindingList. Above that search bar, there is a combobox that allows you to select what shows in the tree. You can have it point to different versions of .NET, your solution, etc. If you really want to find something, flip that to All Components, type your search term, and hit Enter.