francois248
Programmer
Does someone has done something similar with LAPI? I want to add an attachment to an existing document. Here is my code sample. The last call to CreateObjectEx does not work:
//Create the document object in Livelink
if(doc.CreateObjectEx(volumeID, dataID, doc.OBJECTTYPE, doc.DOCUMENTSUBTYPE, "New Document Name", createInfo, objectInfo) != 0)
{
GetErrors(session);
return;
}
else
System.out.println("Document Object Created.");
//create the output variable versionInfo, which will contain the version's information
LLValue versionInfo = (new LLValue()).setAssocNotSet();
//Add a version to the document object
if(doc.CreateVersion(volumeID, objectInfo.toInteger("ID"), "c:\\temp\\Document.txt", versionInfo) != 0)
{
GetErrors(session);
return;
}
else
System.out.println("Version Created.");
//////////////////////////////////////////////////////////////////////
//Setup any information for creation
LLValue createAttInfo = (new LLValue()).setAssocNotSet();
LLValue requestAtt = (new LLValue()).setAssocNotSet();
requestAtt.add("Comment","These is the attahced document.");
createAttInfo.add("request",requestAtt);
//Create a document object attached to an other docuemnt
if(doc.CreateObjectEx(volumeID, objectInfo.toInteger( "ID" ), doc.OBJECTTYPE, doc.DOCUMENTSUBTYPE, "Attached Document", createAttInfo, objectInfo) != 0)
{
GetErrors(session);
return;
}
else
System.out.println("Attached Document Object Created.");
//Create the document object in Livelink
if(doc.CreateObjectEx(volumeID, dataID, doc.OBJECTTYPE, doc.DOCUMENTSUBTYPE, "New Document Name", createInfo, objectInfo) != 0)
{
GetErrors(session);
return;
}
else
System.out.println("Document Object Created.");
//create the output variable versionInfo, which will contain the version's information
LLValue versionInfo = (new LLValue()).setAssocNotSet();
//Add a version to the document object
if(doc.CreateVersion(volumeID, objectInfo.toInteger("ID"), "c:\\temp\\Document.txt", versionInfo) != 0)
{
GetErrors(session);
return;
}
else
System.out.println("Version Created.");
//////////////////////////////////////////////////////////////////////
//Setup any information for creation
LLValue createAttInfo = (new LLValue()).setAssocNotSet();
LLValue requestAtt = (new LLValue()).setAssocNotSet();
requestAtt.add("Comment","These is the attahced document.");
createAttInfo.add("request",requestAtt);
//Create a document object attached to an other docuemnt
if(doc.CreateObjectEx(volumeID, objectInfo.toInteger( "ID" ), doc.OBJECTTYPE, doc.DOCUMENTSUBTYPE, "Attached Document", createAttInfo, objectInfo) != 0)
{
GetErrors(session);
return;
}
else
System.out.println("Attached Document Object Created.");