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!

Document list of a folder

Status
Not open for further replies.

Jerrie85

IS-IT--Management
Feb 10, 2004
29
CA
How would i get the list of documents present in a folder, and iterate through each one of their names?

this in VB;

I can start a session, Get into enterprise, get into personal, using LL_AccessPersonalWorkspace, LL_AccessEnterpriseWS

however, i didn't see a function that lets u access a specific folder with a object ID..;
any help?
 
to understand this please read thru earlier postings
Livelink has a table called dtree on which all objects are present.a folder is of subtype=0 document=144 and so on.one of the fields is child count.the api queries are for objects the assocs that it returns will contain a rich set of information as to subtype child items etc.The best way to understand this is to get a read only connection to your database run a select query on a folder (get the objid that show up from the livelink web interface).This plus the LAPI documentation should give you what you are looking for.
Code:
select * from dtree where subtype=0 //(all folders)
select * from dtree where subtype=144 //(all docs)
A tyical Oracle implemenation will not work in other
RDBMS's showing taxonomy of the enterprise
Code:
select dataid, lpad(' ',2*(level-1)) || name name, subtype
from dtree  where subtype in (0,1,144) start with dataid = <folder objid you are interested> 
connect by prior dataid = parentid
My suggestion is to talk to your livelink admin get a knowledge base account .LAPI programming cannot use a black box approach at this time since using the api does require a good understanding of the system.

Visit greg's site where all of us interact to try to show
a lot of useful thing's.The unofficial livelink site
of the LAPI postings are mine.My website also has links.


Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair
 
i've read ur previous posts and it talks bout ODBC connections; can u use a adodb.connection? i'm more familiar with that;

so the ODBC has to connect to the database structure of my livelink database before i can access the folder names, objects etc? why wasn't it implemented as a function in the API?

 
ODBC is fine I use it all the time regarding your why's on the LAPI implementation these are just my guesses.LAPI is kind of an after thought.Opentext has its own code builder(Oscript) which is far more superior and documented more effectively.LAPI is kind of an extension into other languages mostly integration sort of deal where your jobs is
a one time program getting data in or data out.But things are changing.there is increased pressure on opentext to provide LAPI as a blackbox product,really object oriented so that it will dispell the need for the LAPI programmer to be a livelink guru also.They have actually come up with an alternative to OSCRIPT you could write in java.
Greg Griffith's uses in his workflow tool kit an asp page which accesses the livelink database thru ODBC .I have done a lot of java/odbc's and VB odbc's so this is definitely a possibility

Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair

 
looking at the LAPI docs, wouldn't
LL_ListObjects( _
ByVal session as Long, _
ByVal volumeID as Long, _
ByVal objectID as Long, _
ByVal viewName as String, _
ByVal queryStr as String, _
ByVal permissions as Long, _
ByVal children as Long )
work for listing the objects in a specific folder; it is structured around the schema and the queryStr, viewName list the conditions; however, i do not know how to use this func. could u explain?
 
ill look into the java code snippets you wrote; however, i do not know the ODBC connection string to my livelink db
 
Let me make one more thing clear my suggestion to use the odbc is just for help in understanding.You can do any gui action with LAPI so long as you understand how to use it.Database connection is NOT a must for LAPI because the session actually accesses database as part of the call.I was merely trying to show you how things fall together in livelink.

Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair

 
so LL_ListObjects wouldn't be an option? i need to make a program fast that will modify docs in a specific folder..and ODBC doesn't seem to offer a solution that would be quick to pick up
was wondering maybe this ListObjects was the holy grail to my questions...but need help to figure it out;

wish LAPI was more objectoriented..
 
looking at the docs i think this will work

specify VBNULLSTRING,VBNULLSTRING for viewname and querystring as they are not mandatory and applicable only if the views and queries exist in the database.the return long object that you get as output called children is an assoc that will have almost all the info as in (select * from dtree for objid=)this is expalined very clearly in the documentation

your call will be something like
ll_listobjects(session,2001,<folderobjid>,VBNULLSTRING,VBNULLSTRING,PERM_FULL,chidren_long_initialized)
When your call is scuccesful you should see all output data in the children object


Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair

 
In SQL try the following :

select * from dtree where parentid=1234

Replacing the 1234 with the ObjectID of the Container - e.g. Folder / Workspace etc - that you are interested in.

The resulting recordset contains information about the content of that Container object - only the first level in this example - including the names of the objects in the Container - DTREE.NAME.

I agree with APPNAIR that reading the docs is certainly worthwile and LAPI / OSCRIPT is not always the 'only' method - see the Workflow Toolkit ( which interacts with Workflows using ASP.

Check out which has some links to the documentation, samples and the discussions on the KC.
 
sry if this is a stupid question; would children_long_initiazlied be of type long variable? if so, i tried that and VB hung, and exited with an application error;
 
it is of type long as far i can understnd from the docs
may be the problem is not there the PERM_FULL might be too much use one of the smaller variants
Code:
PERM_CHECKOUT            //     can modify an object's versions (and therefore check out the object)
PERM_CREATENODE          //     can add children to the object
PERM_DELETE              //     can delete the object
PERM_DELETEVERSIONS      //     can delete versions of an object
PERM_EDITATTS            //     can edit the object's category and attributes
PERM_EDITPERMS           //     can edit the object's permission set
PERM_MODIFY              //     can modify an object's characteristics (for example, rename 
                                the object)
PERM_REMOVENODE          //     can delete child objects; this permission must be 
                                included with all objects for Livelink to operate properly
PERM_SEE                 //     can see the object
PERM_SEECONTENTS         //     can see the contents (child objects and/or data) of an object
PERM_FULL                //     all permission granted
These are just my guesses I do not have avb environment now to actaully test it out.Beleive me lapi also have bugs and
mistakes in documentation



Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair

 
nope; tried PERM_FULL_REPLY...Nothing
btw, in my lapi.bas, its defined as PERM_FULL_REPLY, not as PERM_REPLY;

no luck..it stil crashes
 
ll_listobjects(session,2001,<folderobjid>,DTree,VBNULLSTRING,PERM_FULL,chidren_long_initialized)
I think this is how you need to do it
the next part is actully the where part of the query
you could experiment DOCUMENSUBTYPE there etc

Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair

 
so exhausted; tried almost everything to fix this; i think there was another person in this forum who used LL_Objects and had the same problem;

Dim output as long
output = LL_ListObjects(mlngSessionID, mlngParentVolume, mlngParentID, "DTree", "DOCUMENTSUBTYPE", LL_PERM_READ, children)

i tried vbnullstring both, once, tried LL_PERM_FULL, and no difference!
 
FINALLy, it works! I had to LL_ValueAlloc the children long variable for this to work; and the DOCUMENTSUBTYPE wasn't found in the colums so i didn't use it

here's the code (btw, i use debug.Print to get past the output long type)

Dim children as long
Dim length as long
Dim out, outvalue as long

Dim buffer as string * 255 '(this is IMPORTANT; the function can only accept fixed length strings)

debug.Print LL_ValueAlloc(children)
debug.Print LL_ValueAlloc(length)
"" "" "" ..Alloc(out)
"" ..Alloc(outvalue)

debug.Print LL_ListObjects(mlngSessionID, mlngParentVolume, mlngParentID, "DTree", vbNullString, LL_PERM_FULL, children)

debug.print LL_ValueGetLength(children, length)
For i = 0 to length - 1
Debug.Print LL_TableGetValue(children, i, "Name", outValue)
Debug.Print LL_ValueGetString(outValue, buffer, 255, outie)
Debug.Print Left(buffer, outie) 'the function also adds some NULL characters to the end; this just removes them
Next

 
good luck now you know the idiosyncracies.welcome to the club

Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair

 
lol thx; man they should make this easier to use;
instead of always repeating sessionIds, volume, parent IDs,
they should make it Object Oriented; how easy it would be......alas no
 
As AppNair has mentioned in this forum recently, there is a move towards supporting nonOscript development - such as Livelink Live Services (WebService for Livelink).

But LAPI and OScript still seem to get little coverage / support / documentation compared to the use / configuration of the main product. Although the discussions in the KC and the sample Code etc go a long way to help.

The main problem with making LAPI OO is that LAPI also supports other languages such as C++, VB and .Net (see for more.

I agree with another poster recently who would like JavaDocs for LAPI and was also considering writing a Java abstraction layer to take some of the complexity out of using Java with LAPI and make the process more 'Java' like.

I'll contact OT and see if I can get some more info on what is going on.
 
Just another point of view: I've developed the functionality of listing the contents of a folder using LAPI without any problems. In Java, though. So I think adding SQL code and ODBS connections is more complex.

My advice for this case is to use LAPI. Anyway, I agree it's an awful tool, and I still cannot understand what are OpenTxet people thinking on to not improve it.

Cheers.

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top