Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I've learned more from your forums in 3 days than 3 months at school and on the job combined..."

Geography

Where in the world do Tek-Tips members come from?
ahaboub (TechnicalUser)
21 Apr 12 2:00
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.
ahaboub (TechnicalUser)
21 Apr 12 2:17
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
appnair (Programmer)
21 Apr 12 9:30
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
http://www.tek-tips.com/faqs.cfm?fid=2884
http://www.linkedin.com/in/appunair

ahaboub (TechnicalUser)
21 Apr 12 15:23
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
ahaboub (TechnicalUser)
22 Apr 12 3:36
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!!
ahaboub (TechnicalUser)
22 Apr 12 3:40
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!
appnair (Programmer)
22 Apr 12 20:13
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
http://www.tek-tips.com/faqs.cfm?fid=2884
http://www.linkedin.com/in/appunair

ahaboub (TechnicalUser)
23 Apr 12 1:16
ok, thanks for your time

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close