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
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