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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LAPI date attribute

Status
Not open for further replies.

ahaboub

Technical User
Jul 31, 2009
41
0
0
LB
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:
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
I appreciate any giving help.
 
I also tried with an existing document in Livelink to fetch the catversion, and then to input my date attribute as in the same format stored in the catversion
i extracted from the catversion the value D/2012/4/21/9:0:0 and used it in the above code, but still this didnt work
 
Ahaboub see the C# approach here it should be almost identical in VB.NET.There is a LLValueNet class object that you can use to make up a system date.Livelink will not accept a string in place of a date type variable
Code:
System.DateTime testDate = new System.DateTime(intLLISS_YEAR, intLLISS_MONTH, intLLISS_DAY);
					LLValueNET DateValue = new LLValueNET(testDate);
					
					attrValues3.add(DateValue);
					if(attr3.AttrSetValues(catVersion, "Issue Date", LAPI_ATTRIBUTES.ATTR_DATAVALUES, attrValuesPath, attrValues3) != 0)
					{
						WriteErrors(session, "Adding Issue date Failed.");										
					}

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
appnair, I will try your code tomorrow...
in fact, i used the same approach for updating a date attribute in a workflow, and it is working
 
appnair
i tried it, it worked only when submitting the date attribute alone, not with the other attributes
when submitting all of them together, it is not working!!
 
by the way,
when i tried all the attributes together, the category is not assigned to the document, so i just changed the attribute values type to LAPI_ATTRIBUTES.ATTR_TYPE_DATE for the date attribute,
now the category is assigned to the document, but the date attribute is not taking any values!
 
Well the snippet I posted was from a working
Sample that puts everything together not sure
What your problem is. That is how you
Transfer a date attribute type :)

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top