How to update custom attributes in VB LAPI
I am having trouble updating the values of Custom Attributes in code. here's a snippet: status = LL_Initialize(LL_HEADER_VERSION) status = LL_SessionAllocEx(session, gsLLServer, gsLLPort, "", gsLLUser, gsLLPassword, 0) status = LL_ValueAlloc(objInfo) status = LL_ValueAlloc(versionInfo) status = LL_ValueAlloc(files) ' get the Personal WS VolumeID and ID that we need for LL_ListObjects() status = LL_AccessPersonalWS(session, objInfo) status = LL_AssocGetInteger(objInfo, "VolumeID", parentVol) status = LL_AssocGetInteger(objInfo, "ID", parentID) ' grab files collection status = LL_ListObjects(session, parentVol, parentID, "DTree", vbNullString, LL_PERM_READ, files) 'see how many files are there status = LL_GetNumberOfObjects(session, parentVol, parentID, fileCount) ' enumerate thru all the files on Personal WS For i = 0 To fileCount - 1 'grab some values that we would need later, to tell LL which object we wanna update status = LL_TableGetInteger(files, i, "ID", fileID) status = LL_TableGetInteger(files, i, "VolumeID", fileVol) status = LL_GetObjectInfo(session, fileVol, fileID, objInfo) ' passing "DTree" in the view param of LL_ListObjects excludes the MimeType attribute status = LL_GetVersionInfo(session, fileVol, fileID, 0, versionInfo) status = LL_AssocGetString(versionInfo, "MimeType", mimeType, Len(mimeType), outSize) mimeType = Left(mimeType, outSize) ' the next lines of code return the right value for the custom attributes status = LL_TableGetString(files, i, "Contributor", sContributor, Len(sContributor), outSize) status = LL_TableGetDateEx(files, i, "ContributedDate", lYear, lMonth, lDay, lHour, lMinute, lSecond) creationDate = Now() lYear = year(creationDate) lMonth = month(creationDate) lDay = day(creationDate) lHour = hour(creationDate) lMinute = minute(creationDate) lSecond = second(creationDate) ' the next two lines of code returns an OK status, but don't really update the attributes 'status = LL_TableSetString(files, i, "Contributor", sContributor) 'status = LL_TableSetDateEx(files, i, "ContributedDate", lYear, lMonth, lDay, lHour, lMinute, lSecond) ' in the next three lines of code, ONLY CreateDate gets updated as it's not a custom attribute status = LL_ValueSetFieldString(objInfo, "Contributor", fileName) status = LL_ValueSetFieldDateEx(objInfo, "CreateDate", lYear, lMonth, lDay, lHour, lMinute, lSecond) status = LL_ValueSetFieldDateEx(objInfo, "ContributedDate", lYear, lMonth, lDay, lHour, lMinute, lSecond) status = LL_UpdateObjectInfo(session, fileVol, fileID, objInfo) Next iI also tried this approach: status = LL_GetObjectAttributes(session, fileVol, fileID, attributes) Dim attrName As String * 254 'I had to hard code the number of custom attributes as I don't know how to extract it. Anyone knows? For j = 0 To CUSTOM_ATTRIBUTES - 1 attrName = "" status = LL_TableGetString(attributes, j, "AttrName", attrName, Len(attrName), outSize) Select Case Trim(attrName) Case "Contributor" status = LL_TableGetString(attributes, j, "Value", sContributor, Len(sContributor), outSize) Debug.Print Trim(sContributor) 'would show the current value sContributor = "new Value" status = LL_TableSetString(attributes, j, "Value", sContributor) Case "ContributedDate" '.... End Select Next j status = LL_SetObjectAttributes(session, fileVol, fileID, attributes)Can anyone tell me what I am missing or what I'm doing wrong? TIA,Ren