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!

API error: -2147418107 2

Status
Not open for further replies.

psmello

Programmer
May 14, 2003
10
US
I get the above error at the following line in the code below (entire function listed below):

If (status = LL_OK) Then
status = LL_AssocSetInteger(catID, "ID", g_lngDocDateID)
End If

I'm getting the g_lngDocDateID from an INI file when the app loads. This is the objectID of the category that I created and it was retreived by right-clicking on the the object, and seeing it in the properties list.

Any ideas?

Many thanks,

PSMELLO




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

Dim status As Long
Dim NodeID As Long
Dim nodeVol As Long
Dim lObjInfo As Long
Dim createInfo As Long
Dim verInfo As Long
Dim sYear As String
Dim sMonth As String
Dim sDay As String
Dim lYear As Long
Dim lMonth As Long
Dim lDay As Long
Dim catID As Long
Dim catVersion As Long
Dim attrValues As Long
Dim lDocDateID As Long
Dim categories As Long
Dim cRequest As Long
Dim extData As Long

status = LL_OK

Create_LLDoc = 0

If (status = LL_OK) Then
status = LL_ValueAlloc(createInfo)
End If
If (status = LL_OK) Then
status = LL_ValueAlloc(lObjInfo)
End If
If (status = LL_OK) Then
status = LL_ValueAlloc(verInfo)
End If

'Date conversion stuff
If g_strDate = "" Then
g_strDate = CStr(month(Now) & "/" & day(Now) & "/" & year(Now))
End If

sYear = year(CDate(g_strDate))
lYear = CLng(sYear)

sMonth = month(CDate(g_strDate))
lMonth = CLng(sMonth)

sDay = day(CDate(g_strDate))
lDay = CLng(sDay)

'Category stuff
If (status = LL_OK) Then
status = LL_ValueAlloc(catID)
End If

If (status = LL_OK) Then
status = LL_ValueAlloc(catVersion)
End If

If (status = LL_OK) Then
status = LL_ValueAlloc(attrValues)
End If

If (status = LL_OK) Then
status = LL_ValueAlloc(categories)
End If

If (status = LL_OK) Then
status = LL_ValueAlloc(cRequest)
End If

If (status = LL_OK) Then
status = LL_AssocSetInteger(catID, "ID", g_lngDocDateID) 'ERROR OCCURRING HERE
End If

If (status = LL_OK) Then
status = LL_AssocSetInteger(catID, "Version", 0)
End If

If (status = LL_OK) Then
status = LL_FetchCategoryVersion(session, catID, catVersion)
End If

status = LL_ValueSetList(attrValues)
status = LL_ListSetDateEx(attrValues, 0, lYear, lMonth, lDay, 0, 0, 0)

If (status = LL_OK) Then
status = LL_AttrSetValues(session, catVersion, "Document Date", LL_ATTR_DATAVALUES, 0, attrValues)
End If

'Add category info to createInfo
status = LL_ValueSetList(categories)
status = LL_ListSetValue(categories, 0, catVersion)

status = LL_AssocSetAssoc(cRequest, "Comment")

status = LL_AssocSetAssoc(cRequest, "request")
status = LL_AssocSetAssoc(extData, "extendedData")
status = LL_AssocSetAssoc(categories, "Categories")


' Add document
status = LL_CreateObjectEx(session, parentVol, lParentID, LL_VERSIONOBJECTTYPE, _
lType, sName, createInfo, lObjInfo)

DoEvents

If (status = LL_OK) Then
status = LL_ValueAlloc(NodeID)
End If

If (status = LL_OK) Then
status = LL_AssocGetInteger(lObjInfo, "ID", NodeID)
End If

If (status = LL_OK) Then
If lType = LL_DOCUMENTSUBTYPE Then
status = LL_CreateVersion(session, parentVol, NodeID, sPath, verInfo)
End If
Else
MsgBox "Error creating Livelink document", vbCritical, "Keyfile-Livelink Migration"

End If

'MsgBox "Create doc success"

Create_LLDoc = NodeID

End Function
 
did you check the category objid from the categories volume to rule out the possibility that you may have the object id of a document rather than the category object itself?
Just checking can't help with VB really difficult try the knowledge base there are lots of VB and VB.net samples there

Everybody is ignorant, only on different subjects. - Will Rogers

appnair

 
I checked the SQL table: LLAttribData and the DefID field yields the same value as when I right-click on the category. Is this the correct table? If not, how else can I check for this ID?

Is there a GUEST account to get to the Livelink knowledge base? I can't get access.

Thanks,

PSMELLO
 
APPNAIR is our resident LAPI guru, but on the KC front if you can speak to your internal Livelink / OT contact who should have an account that you can use or contact your OT sales contact to request one.
 
I think that category is tied like this there is no space to desc the llattrdata table
Code:
select id,defid from llattrdata where id=35297766
In this query what I'm trying to find is the category(defid)
for a document to which that category has been applied
ID(any livelink object that can be categorized) DEFID(category definition or broadly the category object)
ID DEFID
35297766 35302337
35297766 35302337
To really find out that whether you are seeing a category object
Code:
select subtype from dtree where dataid=35302337
you can check whether what you think is a category is in the result set.The subtype should yield 131.For an explanation on subtypes see greg's web site.Cool I use
it all the time
I hope this clarifies the situation I really did not understand the right clicking part since that is not livelink functionality but the internet explorer behaviour
I did check knowledge base on yr behalf but could not find any real useful VB samples.This was perhaps why I chose java for LAPi for one there is a lot of support there.

Everybody is ignorant, only on different subjects. - Will Rogers

appnair

 
Thanks. I was missing this line:

If (status = LL_OK) Then
status = LL_ValueSetAssoc(catID)
End If

I had the LL_ValueAlloc(catID) line, but not the one above. Incidently, I checked the SQL data based on the queries you referenced and it matched the info I had. So, right-clicking within the browser and selecting Properties did give the correct value.

Thanks for the validation.

PSM
 
So were you right clicking a category object or a document.I right clicked on a document object and it gives me only the llObjID in the URL which is actually the objID in dtree?I would think that the only way you could right click and get a category object would be to actaully right click on the category object itself.I am actually used to seeing the categories of the document by clicking(left) on the functions applet and selecting categories from the ensuing 'info' menu

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

appnair

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top