As mentioned earlier we are trying to upgrade categatory using LAPI
we have written below code which is running and upgrading the category but after upgradation it removes all attribute values
Private lSession As Long
Private lStatus As Long
Friend Sub Upgrade()
'The following program is a sample of upgrading an individual document with a new category.
'Initialize the Livelink API. 'The LL_Initialize call initializes the Livelink API, and, in the process, verifies that the text 'definition files and *.dll files are of compatible versions. If initialization fails, an error message 'is printed and execution terminates. Otherwise, execution continues.
'If Not (lStatus) Then
' MsgBox Date & " " & time & ": LL_Initialize Failed, Wrong header or DLL"
'End
'End If
'Allocate value objects. 'The value objects that will be used later in the program are allocated.
'(Value objects are used extensively in Livelink to store many kinds of 'information.
'In this program they store the allocated session and Livelink 'Library object information.)
'If allocation fails, an error message is printed 'and execution terminates. Otherwise, execution continues.
' grab some value objects
' Dim lmessage As Long
' lStatus = LL_ValueAlloc(lmessage)
'
' If (lStatus <> LL_OK) Then
' MsgBox Date & " " & time & ": LL_ValueAlloc(lMessage) failed"
' End
' End If
'Allocate a session and connect to the Livelink server.
'Upon successful initialization, the LL_SessionAllocEx call allocates a session
'and attempts to connect to the Livelink server.
'If the connection cannot be made '( LL_SessionAllocEx does not return LL_OK), execution skips, 'where the connection error is retrieved by making the LL_SessionStatus call and 'is displayed. Otherwise, execution continues. '
'Allocate our session '
'lStatus = LL_SessionAllocEx(lSession, "K0013", 2099, "LIVELINKK0013", "Admin", "livelink", 0)
'lStatus = LL_SessionAllocEx(lSession, "K0013", 2099, "LIVELINKK0013", "Admin", "", 0)
'If (lStatus <> LL_OK) Then
'lStatus = LL_SessionStatus(lSession, siz, lmessage)
'If (lStatus <> LL_OK) Then lStatus = LL_ValueGetString(lmessage, buf, 255, siz)
'End
'End If
'End If
Dim curCatID As Long
Dim buf As Long
lStatus = LL_ValueAlloc(curCatID)
lStatus = LL_ValueSetAssoc(curCatID)
lStatus = LL_AssocSetInteger(curCatID, "ID", 3951) 'CatID of People Folders Category ID
If (lStatus <> LL_OK) Then
MsgBox ("Failed")
End If
' the new category ' get the latest category format
Dim catVersion As Long
lStatus = LL_ValueAlloc(catVersion)
lStatus = LL_ValueSetAssoc(catVersion)
lStatus = LL_FetchCategoryVersion(lSession, curCatID, catVersion) ' get the new categoryversion
Dim objID As Long
Dim catIDList As Long
Dim catID As Long
Dim upgradeInfo
lStatus = LL_ValueAlloc(catIDList)
lStatus = LL_ValueAlloc(objID)
lStatus = LL_ValueAlloc(catID)
lStatus = LL_ValueAlloc(upgradeInfo)
lStatus = LL_ValueSetAssoc(objID)
lStatus = LL_AssocSetInteger(objID, "ID", 1154777) 'You can get the categoryIDs of Peoplefolder whose objID 1154777
Dim lCatDocVersion As Long
lStatus = LL_ValueAlloc(lCatDocVersion)
lStatus = LL_ValueSetAssocInArgs(catID)
lStatus = LL_AssocSetInteger(catID, "ID", 3951) '# is the category ID.
lStatus = LL_GetObjectAttributesEx(lSession, objID, catID, lCatDocVersion) ' get the Peoplefolder category data
Dim DataAssocOut As Long ' Get the data out of the Peoplefolders category
lStatus = LL_ValueAlloc(DataAssocOut)
lStatus = LL_ValueSetAssocInArgs(DataAssocOut)
lStatus = LL_AttrGetInfo(lSession, lCatDocVersion, "Applicant Number", 0, DataAssocOut)
lStatus = LL_AssocGetInteger(DataAssocOut, "length", buf)
'lStatus = LL_AssocGetValue(lCatDocVersion, "Applicant Number", DataAssocOut)
'lStatus = LL_AssocGetInteger(DataAssocOut, "value", buf)
' put the document into the category upgrade assoc ' -catVersion ' - catID ' - DisplayName ' - ID ' - type ' - version ' - data ' set this from the original document ' - ID ' - Values ' - definition ' - Children ' - DisplayName ' - FixedRows ' - ID ' - MaxRows ' - Name ' - NextID ' - NumRows ' - Required ' - Type ' - ValueTemplate ' - ID ' - Values
lStatus = LL_AssocSetValue(catVersion, "Applicant Number", DataAssocOut) ' do not add a version to upgrade.
lStatus = LL_ValueSetAssoc(upgradeInfo)
lStatus = LL_AssocSetBoolean(upgradeInfo, "AddVersion", False)
lStatus = LL_ListObjectCategoryIDs(lSession, objID, catIDList) ' get the category ID assocs that are on the object
Dim intLength As Long
lStatus = LL_ValueGetLength(catIDList, intLength)
Dim i As Integer
For i = 0 To intLength - 1
lStatus = LL_ListGetValue(catIDList, i, catID)
'lStatus = LL_UpgradeObjectCategory(lSession, objID, catID, catVersion, upgradeInfo)
lStatus = LL_UpgradeObjectCategory(lSession, objID, catID, , upgradeInfo)
Next i
End Sub
Public Function Intilize() As Boolean
Dim status As Long
Intilize = True
status = LL_Initialize(LL_HEADER_VERSION)
If status <> LL_OK Then
Intilize = False
End If
status = LL_SessionAlloc(lSession, "stallsys01", 2099, "", "agachake", "agachake")
If status <> LL_OK Then
Intilize = False
End If
End Function
Private Sub Command1_Click()
Call connect
End Sub
Friend Sub connect()
If Intilize() Then
MsgBox ("Initialization")
'Call upgrade
Else
MsgBox ("failed initilize")
End If
End Sub
Private Sub Command2_Click()
Call Upgrade
End Sub
please help which option we need to set so that after upgradation attribute values should not get removed
Thanks in Advance