Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Compliments on a fantastic web site. I have learned so much from my threads and even if sometimes I cannot solve the problem, it gives me the reassurance that I am not the only one putting up with it!..."

Geography

Where in the world do Tek-Tips members come from?
psmello (Programmer)
2 Dec 03 16:15
I get an error each time I use the AddDocument function in the LAPI.  The error is a memory error on one machine and the app just bombs with no error on another machine.  I've tried different files (TXT & TIFF), but the same error occurs.  The doc does get created, but not without the error.

Also, I've tried to use the CreateObjectEx function and get the same problem.  But this function does not create the document.  I've tried to add to the root of the Enterprise Workspace as well as other sub-folders.  Same problem.

What am I missing?  Does anyone have an example?  Here's the function I created:

Public Function Create_LLDoc(ByVal lParentID As Long, ByVal sName As String, ByVal lType As Long, ByVal sPath As String) As String

    Dim status As Long
    Dim NodeID As Long
    Dim nodeVol As Long
    Dim lObjInfo As Long
    
    ' Add document
    'status = LL_AddDocument(session, parentVol, lParentID, sName, sPath, ObjInfo, 0)
    status = LL_CreateObjectEx(session, parentVol, lParentID, LL_OBJECTTYPE, lType, sName, 1, lObjInfo)

    If (status = LL_OK) Then
        status = LL_AssocGetInteger(ObjInfo, "ID", NodeID)
    End If
    
    status = LL_CreateVersion(session, parentVol, NodeID, sPath, 1)
        
    If (status = LL_OK) Then
        CreateLLDoc = CStr(NodeID)
    Else
        CreateLLDoc = ""
    End If
      
End Function

Thanks!
appnair (Programmer)
3 Dec 03 14:54
If the document gets created with the error can you not get the error back from lapi since LAPI has  error handling.If the error is not lapi and windows are you using a well defined port to do this some ports are designed for specific services.Anyways after you install lapi on the windows machine which I presume has the livelink software also run your sample from another windows machine by copying only the lapi files and compiling on that machine and see if you can replicate it.I have done some lapi experimentation with java and it has worked for me very well and most of windows problems may be resolved by re-installing the winsock dll
Also VBsamples are in the knowledge base.
psmello (Programmer)
10 Dec 03 5:35
Thanks.  I've tried the app on several machines and against two different Livelink server.  In all cases, Windows hoses the app.  No error is returned from the LAPI.  I've used the LAPI with port 2099, and HTTPS with both the ISAPI DLL and LIVELINK.EXE via port 80.  Could this be a LAPI DLL version issue?
appnair (Programmer)
10 Dec 03 11:17
Maybe this is a version issue and you should try the opentext knowledge base LAPI discussion.I'm a novice when it comes to https and VB.Sorry cannot help you there.
JohnUnderhill (TechnicalUser)
15 Jan 04 4:39
You need to alocate all the variables that you pass to the function before you use them. You then need to deallocate afterwards. LAPI functions do not pass variables, they pass long pointers to allocated memory.

Sample here. This function adds a new doc or does an Add Version if "name" exists. Below is the GetNodeID function that it uses as well. I used have a LAPI based function for GetNodeID but it was too slow and I used it a lot, so I cheat and use SQL! "Log" and "SafeSQLString" are other misc function I have in my libraries, but you can delete these lines if you don't have similar.

Function Livelink_DocumentAdd(ByVal lngParentId As Long, ByVal Name As String, ByVal file As String) As Long 'load a document from file into node and call it name
    Dim ReturnStatus As Long
    Log "Loading into Node: " & lngParentId, 3
    status = LL_ValueAlloc(tmpAttribs)
    status = LL_ValueAlloc(tmpCreate)
    status = LL_ValueAlloc(tmpObject2)
    status = LL_ValueAlloc(tmpObject)
    status = LL_ValueAlloc(tmpVersion)
    tmpDocNodeID = GetNodeID(lngParentId, Name)
    If tmpDocNodeID = 0 Then
        Log "Create New : " & Name, 3
        ReturnStatus = LL_AddDocument(lngSession, lngVolumeID, lngParentId, Name, file, tmpObject2, tmpVersion)
    Else
        Log "Add Version : " & Name, 3
        ReturnStatus = LL_CreateVersion(lngSession, lngVolumeID, tmpDocNodeID, file, tmpObject2)
    End If
    status = LL_ValueFree(tmpAttribs)
    status = LL_ValueFree(tmpObject)
    status = LL_ValueFree(tmpObject2)
    status = LL_ValueFree(tmpVersion)
    status = LL_ValueFree(tmpCreate)
    Livelink_DocumentAdd = ReturnStatus
End Function

Function GetNodeID(ByVal lngParent As Long, ByVal strChild As String) As Long
    'returns the node ID of a child of lngParent called strChild
    'This function gets the ID direct from the database. It is much quicker than looping through the
    'child nodes via LAPI.
    Dim lngID As Long
    Dim strSQLStatement As String
    Dim rsParentNode As ADODB.Recordset
    strChild = SafeSQLString(strChild)
    strSQL = "SELECT dataid FROM dtree WHERE name = '" & strChild & "' AND parentid = " & lngParent
    Set rsLL = objLLConn.Execute(strSQL)
    If rsLL.EOF Then
        GetNodeID = 0
    Else
        GetNodeID = rsLL!dataid
    End If
End Function


Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close