Community
Showing results for 
Search instead for 
Do you mean 
Reply

How do I attach Document in ACT under Document TAB through ACT SDK as part of Web Service

New Member
Posts: 1
Country: Netherlands

How do I attach Document in ACT under Document TAB through ACT SDK as part of Web Service

I want to create Web Service for creating new contact with attached document. Implemented Web Service is working properly as part of VS 2008 development environment. But publishing Web Service on IIS and and attaching Document to newly created Contact cause problems . Here is a code:

 

string attachmentName = "cv" + System.DateTime.Now.ToShortDateString() + ".html";

attachmentName = attachmentName.Replace("/", "_");

string fullAttachmentName = "c:\\ActWs\\" + attachmentName;

FileInfo f = new FileInfo(fullAttachmentName);

StreamWriter w = f.CreateText();

w.WriteLine(cv);

w.Close();

Attachment attachment = ActFrameworkFactory.getAct().SupplementalFileManager.CreateAttachment(AttachmentMate.History, fullAttachmentName, attachmentName, false);

HistoryType historyType = new HistoryType(SystemHistoryType.Library);

History newHistory = ActFrameworkFactory.getAct().Histories.CreateHistory(cContact, Guid.Empty, historyType, false, System.DateTime.Now, System.DateTime.Now, "proba history type", "", attachment);

newHistory.Update();

f.Delete();

 As message I've got following stacktrace:

 

2008-06-23 16:28:22,265 [1] ERROR ActWs.ActWs - at Act.Framework.Histories.HistoryManagerDB.InsertHistoryItem(History history, CommandProcessor processor)

at Act.Framework.Histories.HistoryManagerDB.CreateHistory(History history)

at Act.Framework.Histories.HistoryManager.CreateHistory(Guid[] contactKeys, Guid[] opportunityKeys, Guid[] groupKeys, Guid activityClearedId, HistoryType histType, Boolean isPrivate, DateTime displayDate, DateTime endDate, String regarding, String details, Attachment att, Guid createUserID, Guid manageUserID)

at Act.Framework.Histories.HistoryManager.CreateHistory(Guid[] contactKeys, Guid activityClearedId, HistoryType histType, Boolean isPrivate, DateTime displayDate, DateTime endDate, String regarding, String details, Attachment att)

at Act.Framework.Histories.HistoryManager.CreateHistory(Contact contact, Guid activityOccurID, HistoryType histType, Boolean isPrivate, DateTime displayDate, DateTime endDate, String regarding, String details, Attachment att)

at ActWs.ActWs.addToAct(String personDetails, String cv) in C:\Documents and Settings\Loder\My Documents\Visual Studio 2008\Projects\ActWs\ActWs\ActWs.asmx.cs:line

1422008-06-23 16:28:22,265 [1] ERROR ActWs.ActWs - Unable to insert a history

 

I was trying to fix problem with changing privileges to folder where attached document is temporary created, but with no results.

  

 Thanks in advance.

 

 

Tuned Listener
Posts: 7
Country: United Kingdom

Re: How do I attach Document in ACT under Document TAB through ACT SDK as part of Web Service

did you manage to find solution for this problem, because iam having the same problem where in i can attach documents to document tab through web services from vs 2008, but when deploying to IIS it gives an error " unable to insert history"

Thanks for your help

Copper Contributor
Posts: 10
Country: USA

Re: How do I attach Document in ACT under Document TAB through ACT SDK as part of Web Service

I need this, too.

Nickel Contributor
Posts: 175
Country: USA

Re: How do I attach Document in ACT under Document TAB through ACT SDK as part of Web Service

[ Edited ]

Now this is just a quick thought, but whenever you deal with web services (basically a special web page), you need to make sure the permissions are set properly to the folders. I'm not sure on the process that Act is using with the web service, but I suggest looking that the ASP.NET "user" has read/write permissions to the folder where the file will be (not just your temporary store).

 

Another thing to look at is how Act is storing the file. Is it storing the file in the file system, or as a BLOB (Binary Large OBject) in SQL Server? If it is in the file system, on the web server, then the user account that is "running" Act will need permissions to write to the destination folder.

 

In short, make sure Act and the ASP.NET user account all have read/write permissions to all folders that you are utilizing. I hope that helps.

 

Edit: I just noticed, this thread was resurrected from a few years ago. So, dbenglund, could you please provide some information specific to your issue?

Employee
Posts: 1,163
Country: USA

Re: How do I attach Document in ACT under Document TAB through ACT SDK as part of Web Service

I'm asking this question because I didn't not see it as part of the code snippet. But is the newly created contact being updated prior to adding the attachment?

 

And a follow up question, does it throw the same exception for contacts that are already created?

Matthew Wood
Act! SDK Support
Community Moderator