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

How to change document owner in Java 1

Status
Not open for further replies.

smallredville

Programmer
Aug 18, 2008
115
SG
Hi All,

I tried to change the owner of a document with LAPI in java but to no avail.

I hope somebody who knows about it can share with me on how to achieve it.

Lastly, I would like to say many thanks in advance.

smallredville
 
Hi All,

Just to add on some finding which I did:

I tried to change the OwnedBy of a document with LAPI in java but to no avail.

However, I can change the CreatedBy by using UpdateObjectInfo.

I hope somebody who knows about it can share with me on how to achieve it.

Lastly, I would like to say many thanks in advance.

smallredville
 
the key you want to change for owner is from documentation
Code:
UserID 	Integer 	The ID of the user who owns this object 	UpdateObjectInfo

There was a recent discussion at KB regarding this as well


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 and probably certfiable,Livelink ECM Champion 2008

 
Hi Appnair,

First of all, thank you so much for your reply.

I appreciate it very much.

However, I got the following error message when using UserID:

+++ Start of session errors +++
Status Code: 105802
Api Error: Could not update permissions for specified right.
Error Message: Error updating the item 'excelODS.pdf'.
Status Message: Error Updating ObjectInfo
+++ End of session errors +++

The following is section of my java code:

LLValue updateInfo = new LLValue().setAssoc();
updateInfo.add("UserID", 821889);

if (doc.UpdateObjectInfo(volID, 819361,updateInfo) == 0)
{

System.out.println("OK");
}
else
{
//failed
String sessionError = "+++ Start of session errors +++\n";
sessionError += "Status Code: " + session.getStatus() + "\n";
sessionError += "Api Error: " + session.getApiError() + "\n";
sessionError += "Error Message: " + session.getErrMsg() + "\n";
sessionError += "Status Message: " + session.getStatusMessage() + "\n";
System.out.println(sessionError + "+++ End of session errors +++\n");

System.out.println("no");
}

If u have any idea about this, kindly share with me.

Last but not the least, Many thanks in advance...

smallredville
 
That looks like the account user of lapi does not have user administartor privileges.As a very simple test try doing the same stuff you are doing with
the GUI,you know you would click on the permissions of the object logged in as the lapi user in qn and try to change ownership and post your experience.If you get the same error then try with an object to which the userid has permissiins

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 and probably certfiable,Livelink ECM Champion 2008

 
Thanks Appnair for your comment again.

I have successfully run the code with UserID.

But I cant get the Owned By of the document changed to a new user ID.

However, I notice that if I changed directly the userid column in the DTREE table, only then it takes effect(Owned By changed to a new user ID).

If you have any comment, kindly share with me =)

Many thanks in advance,

Regards,
smallredville
 
Changing something in livelink dtree is just asking for trouble if not outright support rejection from OT.I recently debugged another call like a person was trying to restore Public Access thru LAPI and was going wrong similarly like you.I debugged the call and replied to him thus.I am imagining perhaps some simlairity is heppening.I excert form my reply to him
I am a lapi enthusiast and I debugged this for you.LAPI does not have the ability to "Restore" public access .
It can only Add,Update or Delete ACL's.You can give more permissions to an existing PA for eg if PA had
See,SC then you can add more like modfy by doing this
doc.SetObjectRight(volumeid,dataid,LAPI_DOCUMENTS.RIGHT_UPDATE,LAPI_DOCUMENTS.RIGHT_WORLD,doc.PERM_SEE|doc.PERM_SEECONTENTS|doc.PERM_MODIFY,0);

You cannot delete the world perm thru lapi.

Contact OT support to see if you need a patch for this.But here's my diagnosis tracing thru builder .The oscript routine while you do the same command thru the GUI calls NodeUtil.WorldPermEnable which the LAPI call does not all it can do is Add,Update and Delete.The acl of -1 goes thru the 'Update' section of oscript code but it does not call the routine the GUI calls that is why you do not see any error as well as you don't get what you wanted.

Attached a small java file I used to debug.

Since LAPI is in maintenance I don't know if OT will take a bug fix or not.If you know oscript you might be able to call the same thing that OT does.

I will try your scenario later and see if it is a bug.If it is a bug you won't get help because lapi is being deprecated for WS.

You just want an object's ownership to change to another valid userid in livelink correct

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 and probably certfiable,Livelink ECM Champion 2008

 
Hi Appnair,

Sorry for my late reply.

Yup, I intend to change the Owned By with LAPI in java.

Thanks for all your helps =)

I appreciate it very much.

smallredville
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top