Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to attach a document to an existing document? 1

Status
Not open for further replies.

francois248

Programmer
Feb 16, 2006
2
BE
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.");
 
I believe you have the concept wrong,In livelink there are container objects like folder,projects,compound documents.You can basically add one or more documents to those object subtypes.Each of these will have an unique objectid.If a document is existing in livelink,there is no lapi command to attach another document to it.That has to be acheived outside of lapi like a merging program(What you are asking is like adding more pages toa n existing document).It can be done .You have to download the current version to a file system using lapi,then using a merging program,build that additionl document and upload it back.for eg mergr pdf offers command line stuff to add more pages to an existing pdf document.

By using the concept of compound documents you can indeed create a bunch of documents inside one object,but they all are individual objects.


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Hello appnair, I am not agree. Look at the Export XML file included, you will see that the first node (id=327810) is a document with a parentid=325721 that is a folder. But the second node (id=328355) has the previous for parent (parentid=327810).

I can attach a document to an existing document with the Web interface so why I could not do it with LAPI?


<?xml version="1.0" encoding="UTF-8" ?>
- <livelink applanguage="USA" appversion="9.2.0" dtdversion="1.2">
- <llnode created="2006-02-14T16:00:00" createdby="1000" createdbyname="Admin" id="327810" mimetype="text/plain" modified="2006-02-14T16:53:35" name="AttachedDocument" objname="Document" objtype="144" ownedby="1000" ownedbyname="Admin" parentid="325721" size="8" versionnum="1">
- <category defid="325624" disableinheritance="false" name="C1" versionid="1">
- <attributeset attid="1" name="C1">
<attribute attid="2" name="A1" type="2" />
</attributeset>
</category>
- <node cacheexpiration="0" catalog="0" childcount="1" createdate="2006-02-14T16:00:00" createdby="1000" groupid="1001" groupperm="36995" id="327810" maxversion="-1" modifydate="2006-02-14T16:53:35" name="AttachedDocument" originalid="0" originalvolid="0" parentid="325721" reserved="0" reservedby="0" subtype="144" systemperm="16777215" userid="1000" userperm="16777215" versionnum="1" volumeid="-2000" worldperm="36995">
- <permission>
<acl create="true" delete="true" deletever="true" editattr="true" editperm="true" modify="true" name="Admin" permissions="16777215" permtype="1" reserve="true" rightid="1000" rightname="Admin" righttype="0" see="true" seecontent="true" />
<acl create="false" delete="false" deletever="false" editattr="false" editperm="false" modify="false" name="DefaultGroup" permissions="36995" permtype="2" reserve="false" rightid="1001" rightname="DefaultGroup" righttype="1" see="true" seecontent="true" />
<acl create="false" delete="false" deletever="false" editattr="false" editperm="false" modify="false" name="Public Access" permissions="36995" permtype="3" reserve="false" rightid="-1" rightname="Public Access" righttype="1" see="true" seecontent="true" />
<acl create="true" delete="true" deletever="true" editattr="true" editperm="false" modify="true" name="GED development" permissions="258191" permtype="0" reserve="true" rightid="281234" rightname="GED development" righttype="1" see="true" seecontent="true" />
<acl create="true" delete="true" deletever="true" editattr="true" editperm="true" modify="true" name="GED Project Team" permissions="258207" permtype="0" reserve="true" rightid="7605" rightname="GED Project Team" righttype="1" see="true" seecontent="true" />
</permission>
</node>
- <version createdate="2006-02-14T16:00:00" filecreatedate="2006-02-14T15:54:17" filedatasize="8" filemodifydate="2006-02-14T15:54:38" filename="document.txt" fileplatform="2" fileressize="0" filetype="txt" id="327812" indexed="0" locked="0" mimetype="text/plain" modifydate="2006-02-14T16:00:00" name="1" nodeid="327810" number="1" owner="1000" providerid="327811" providername="EXTSHARED">
<content type="base64">RG9jdW1lbnQ=</content>
</version>
</llnode>
- <llnode created="2006-02-14T16:53:35" createdby="211037" createdbyname="Cantin, François" id="328355" mimetype="text/plain" modified="2006-02-14T16:53:35" name="Attachment 1" objname="Document" objtype="144" ownedby="211037" ownedbyname="Cantin, François" parentid="327810" size="21" versionnum="1">
- <category defid="325624" disableinheritance="false" name="C1" versionid="1">
- <attributeset attid="1" name="C1">
<attribute attid="2" name="A1" type="2" />
</attributeset>
</category>
- <node cacheexpiration="0" catalog="0" childcount="0" createdate="2006-02-14T16:53:35" createdby="211037" groupid="1001" groupperm="36995" id="328355" maxversion="-1" modifydate="2006-02-14T16:53:35" name="Attachment 1" originalid="0" originalvolid="0" parentid="327810" reserved="0" reservedby="0" subtype="144" systemperm="16777215" userid="211037" userperm="16777215" versionnum="1" volumeid="-2000" worldperm="36995">
- <permission>
<acl create="true" delete="true" deletever="true" editattr="true" editperm="true" modify="true" name="ca01051" permissions="16777215" permtype="1" reserve="true" rightid="211037" rightname="Cantin, François (ca01051)" righttype="0" see="true" seecontent="true" />
<acl create="false" delete="false" deletever="false" editattr="false" editperm="false" modify="false" name="DefaultGroup" permissions="36995" permtype="2" reserve="false" rightid="1001" rightname="DefaultGroup" righttype="1" see="true" seecontent="true" />
<acl create="false" delete="false" deletever="false" editattr="false" editperm="false" modify="false" name="Public Access" permissions="36995" permtype="3" reserve="false" rightid="-1" rightname="Public Access" righttype="1" see="true" seecontent="true" />
<acl create="true" delete="true" deletever="true" editattr="true" editperm="false" modify="true" name="GED development" permissions="258191" permtype="0" reserve="true" rightid="281234" rightname="GED development" righttype="1" see="true" seecontent="true" />
<acl create="true" delete="true" deletever="true" editattr="true" editperm="true" modify="true" name="GED Project Team" permissions="258207" permtype="0" reserve="true" rightid="7605" rightname="GED Project Team" righttype="1" see="true" seecontent="true" />
</permission>
</node>
- <version createdate="2006-02-14T16:53:35" filecreatedate="2006-02-14T16:53:35" filedatasize="21" filemodifydate="2006-02-14T16:53:35" filename="AttachedDoc.txt" fileplatform="2" fileressize="0" filetype="txt" id="328357" indexed="0" locked="0" mimetype="text/plain" modifydate="2006-02-14T16:53:35" name="1" nodeid="328355" number="1" owner="211037" providerid="328356" providername="EXTSHARED">
<content type="base64">VGVzdCBEb2N1bWVudCBhdHRhY2jp</content>
</version>
</llnode>
</livelink>
 
I am wrong then.Apologize,
"I can attach a document to an existing document with the Web interface so why I could not do it with LAPI?"
How do you do this with the web interface.Can you walk me thru the steps ?Or the above example was it accomlished with the txt editor in livelink?




Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
You can't add a document as an attachment to another document in out of the box Livelink. Perhaps you have a customization that allows this document attachment functionality?

You can only add documents to objects that are containers (folders, projects, compound documents, etc.) In Livelink, the object definition must have the fContainer attribute set to true for a document to be added to it as a child.

When I imported your XML Export I got two documents in the import directory, AttachedDocument and Attachment 1. I did not get a document attached to another document.

If you do have a customization then you would have to enhance the LAPI code for CreateObjectEx to add the ability to add documents as attachments to other documents. Out of the box Livelink doesn't allow this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top