Community
Showing results for 
Search instead for 
Do you mean 
Reply

How can I add contact document by API?

New Member
Posts: 4
Country: Taiwan

How can I add contact document by API?

Dear all,

 

I try to add a new picture to Act, but it can not work.

I am not sure the way is correct : 

 

Act.Framework.SupplementalFiles.Attachment att = m_ActFramework.SupplementalFileManager.CreateAttachment(Act.Framework.SupplementalFiles.AttachmentMate.Note, "C:\\TO.jpg", "testname", true);

 

 

m_ActFramework.SupplementalFileManager.AddAttachment(att, actContact.ID);

 

It will error catch in " m_ActFramework.SupplementalFileManager.AddAttachment(att, actContact.ID); "

The error message is " The INSERT statement conflicted with the FOREIGN KEY constraint \"ATTACHMENT_NOTEID_FK\". The conflict occurred in database \"penpower\", table \"dbo.TBL_NOTE\", column 'NOTEID'.\r\nThe statement has been terminated. "

 

Help me,please!!!!

Thanks for all.

Employee
Posts: 1,163
Country: USA

Re: How can I add contact document by API?

Hello VinaShen,

 

There are a couple of examples already in the forum for creating attachments:

 

http://community.act.com/t5/ACT-Developer-s-Forum/Create-History-with-File-Attachment/m-p/101659/hig...

http://community.act.com/t5/ACT-Developer-s-Forum/Attach-Excel-document-to-Contact-in-PlugIn/m-p/169...

 

There are more but these two both include sample code. The thing to keep in mind is that an attachment on the documents tab is a History of type Library Document. 

 

Hope this helps.

Matthew Wood
Act! SDK Support
Community Moderator