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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regarding Adding Document along with Categories and Attributes 1

Status
Not open for further replies.

Malempati

IS-IT--Management
Jul 5, 2012
4
CA
Hi All,

Can anyone provide a VB application,that uploads a document using LAPI methods.
And appends the Category along with some attributes also.
I have written the code,but i'm not suceeded with that.I felt the sequence which i followed was not the one exactly required.
Thanks in advance.

Regards,
Malempati
 
Have you seen the examples communities.opentext.com and knoledge.opentext.com greggriffiths.org
And things like that. I am not sure you want old VB6 mostly you should be able to find C# and VB.NET
Examples and they can be retrofitted for your purpose.

Here's the sequenec. If you post your code I can try to see where you are going wrong.

Common to any LAPI code
1)LAPI needs to be installed and path,classpath set
2) You need a working livelink server a userid/password created for you to try things or you need an account in a SSO livelink but the first one is way too easy for programmers starting with lapi.

Now the code will be like this in most cases and this is what you refer by sequence. To make it easier I will explain with the aid of a user adding a document with required atts in a category

1) Log into livelink LAPI-establish LAPI session
2) Find a place in livelink that you can add LAPI-figure out a parentid/volumeid combination numbers indicate dataid's in livelink
3) You will now find the version of a category that you want LAPI-Fetch Version (using dataid of category)
4)In gui you will enter any mandatory values and optional ones LAPI-You will use setter methods of the categoryversion data structure, very tedious if you are very new or do not understand how to parse datastructures. Look in old examples for help
5) In GUI you will find a file and add LAPI-you will create a node of type document and then follow it up with CreateVersion.

OK now if you were starting new the preferred API for livelink is not LAPI but Content Web Svcs. Note name livelink changed to content server and hence its API called that way. But that too you will need to understand the GUI methods and then you will have fewer troubles. The newer websvcs has much more good support for taking out the category/attribute datastructure but unless you know how livelink enforces its business rules you will never succeed in being a good programmer with it :)


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Hi ggriffit & appnair,

Thanks for your replies.
and here is the VB code which i used for adding a document and then updating the category to it:

CODE:
lStatus = LL_Calligo_AddDocument( _hSession, _VolumeID, _iNodeID, _filename, _uploadFile, _
hDocumentInfo, _
hVersionInfo)
If lStatus <> LL_OK Then
logInfo "Failed to add new document after delete" & uploadFile, 2
' GoTo err_handler

Else
lStatus = LL_AssocGetInteger(hDocumentInfo, "ID", DocumentID)
If lStatus <> LL_OK Then
logInfo "Failed to get new added Document ID" & uploadFile, 2
GoTo err_handler

End If
lStatus = LL_AssocGetInteger(hVersionInfo, "Number", version)
If lStatus <> LL_OK Then
logInfo "Failed to get document's version" & uploadFile, 2
GoTo err_handler
End If

'**** For Category ***
Dim nodeVol, nodeID As Long
lStatus = LL_ValueAlloc(nodeVol)
lStatus = LL_ValueAlloc(nodeID)
' Node Vol. and the node ID of the Document for which category needs to be uploaded
lStatus = LL_AssocGetInteger(hDocumentInfo, "VolumeID", nodeVol)
lStatus = LL_AssocGetInteger(hDocumentInfo, "ID", nodeID)

'*** Category Creation ***'
lStatus = LL_CreateObjectEx(hSession, nodeVol, nodeID, LL_OBJECTTYPE,
LL_CATEGORYSUBTYPE, sName, createInfo, lObjInfo)
If lStatus <> LL_OK Then
logInfo "'Failed to create Category:' " & "Insurance", 2
Exit Function
End If

and the lStatus here is returning the value 101102.
Is any reference is missing?

Thanks in Advance,
Malempati
 
Hi There,

Why would you try to "CREATE" a category rather than "APPLY" it ?

What you are doing in code is akin to a user in livelink "CREATING" a category subtype(131)
your code
'*** Category Creation ***'
lStatus = LL_CreateObjectEx(hSession, nodeVol, nodeID, LL_OBJECTTYPE,
LL_CATEGORYSUBTYPE, sName, createInfo, lObjInfo)

tells me that.In livelink a category object is pre created and that template(it is just that) is used to define additional
metadata about an object.It is not as if if you were adding 1000 documents 1000 categories also were added.I would suspect
that if each document/folder in livelink had its own category object it would be a terribly useless system.There is nothing preventing
you in lapi in creating 1 million category objects,it would just hog the search system.

Hope you understand the livelink business rules.

So in VB6 you would either create a category using the gui and note its dataid
.Note its dataid.Now using the gui add the document,find the category
that you added in step 1,fill its values and add.So livelink will register the node in dtree and the node's attribute data
in llattrblobdata and llattrdata.



Here's a java sample I wrote long time back
that does this

1)It adds a document
2)While doing that it sets the values of a category object for the document type.Note I do not create
a category object in this code.This is applying we are not changing the actual category template itself.
3)All said and done if you look at the categories tab of the document object in the GUI it will show the
metadata the program put there

all you have to do is understand the program flow and use VB6 for it.n

I do not have VB6 or it would take me no time to write a small sample for you
If it is a microsoft shop I would try examples in C# and convert it into VB6.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Hi appnair,

That was a very great help from you.
We got rid of great effort.

So as per u'r suggestion i now got the catID of the uploaded document's category ID.
Now my doubt is, for setting the attributes to the category should we use the method "LL_SetObjectAttributesEx()".
If so what should be the 'objId' parameter passed to this method.

Thanks in advance,
Malempati
 
I don't have access to livelink for some time but
"LL_SetObjectAttributesEx()" from my experience it would be like this

the previous call FetchCategoryVersion(dataid/nodeid/nodeid) would give you a
a llvalue objectid.For simplicity assume the category has 3 attributes a text field
a date field and a integer field.

What one is supposed to do at this point is basically use three calls to set each value separately
associate it to the catversion.

When the update call hits livelink the oscript parser will de-serialize the catversion object and pick out
individual values and do the needful.Remarkable parses etc in code.

unfortunately you have picked vb6 so I have to be this cryptic and feel like a scool master explaining things
It doesnot have to be this difficult as category manipulation is almost a lot of coding one does.

As I would have mentioned earlier websvcs alleviates the monstrous datastructures( I have great respect
for the original lapi coders)but once you know how to understand them it is just very simple

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Hi appnair,

It seems that since i was calling LL_SetObjectAttributesEx() method after setting all the attributes,it was failing.
After reply from you i'm now calling LL_SetObjectAttributesEx() after setting each of the attribute value(LL_AttrSetValues).
And i have about 20 atributes to be updated.
But LL_SetObjectAttributesEx() is succeding until setting the 6th attribute.AFter that this method is returning 107404 error.
Can you direct me what might be wrong?

Thanks in advance,
Malempati.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top