Hello,
Using vb.net, I am trying to upload a document, retrieve its nodeid, and then update its category attributes. Everything would work well without updating a date attribute.
If i update the date attribute, i will not see the category assigned to the document (there is no exception also), here is the code i am using:
I appreciate any giving help.
Using vb.net, I am trying to upload a document, retrieve its nodeid, and then update its category attributes. Everything would work well without updating a date attribute.
If i update the date attribute, i will not see the category assigned to the document (there is no exception also), here is the code i am using:
Code:
Dim mySess = New LLSession(tboLivelinkServer.Text, CInt(tboPort.Text), tboLivelinkDB.Text, tboLivelinkUser.Text, tboLivelinkPwd.Text)
Dim docid As Integer = 0
Try
Dim doc As New LAPI_DOCUMENTS(mySess)
Dim status As Integer
status = doc.AccessPersonalWS(New LLValue())
If status = 0 Then
Dim info1 As New LLValue()
Dim info2 As New LLValue()
status = doc.AddDocument(-2000, 22747, filepath.Substring(filepath.LastIndexOf("\") + 1), filepath, info1, info2)
docid = info1.toInteger("ID")
Dim attr As New LAPI_ATTRIBUTES(mySess)
Dim catid2 As New LLValue()
Dim catversion As New LLValue()
catid2.setAssoc()
catid2.add("Type", LAPI_ATTRIBUTES.CATEGORY_TYPE_LIBRARY)
catid2.add("ID", 12231)
status = doc.FetchCategoryVersion(catid2, catversion)
If status = 0 Then
Dim avpath As New LLValue()
Dim attrvalues As New LLValue()
Dim objid As New LLValue()
attrvalues.setList()
attrvalues.setSize(1)
attrvalues.setString(0, CP1256_UTF8("test"))
status = attr.AttrSetValues(catversion, "Mail #", LAPI_ATTRIBUTES.ATTR_DATAVALUES, avpath, attrvalues)
'HERE IS THE CODE I AM HAVING PROBLEM WITH
'I TRIED DIFFERENT FORMAT FOR THE STRING DATE VALUE, AND NOTHING WORKED
attrvalues.setString(0, Date.Now.ToString)
status = attr.AttrSetValues(catversion, "Mail Date", LAPI_ATTRIBUTES.ATTR_DATAVALUES, avpath, attrvalues)
attrvalues.setString(0, CP1256_UTF8("test"))
status = attr.AttrSetValues(catversion, "Subject", LAPI_ATTRIBUTES.ATTR_DATAVALUES, avpath, attrvalues)
objid.setAssoc()
objid.add("Type", LAPI_DOCUMENTS.OBJECTTYPE)
objid.add("ID", docid)
status = doc.SetObjectAttributesEx(objid, catversion)
End If
Else
MsgBox("could not access server")
Return False
End If
Catch ex As Exception
MsgBox("Error uploading document with category. Details: " & ex.Message)
Return False
End Try