API Questions on Kentico API.
Version 6.x > API > NodeOwner vs DocumentCreatedByUserID and setting through API View modes: 
User avatar
Member
Member
CC - 11/27/2011 6:31:06 PM
   
NodeOwner vs DocumentCreatedByUserID and setting through API
I have the situation where one user is creating a document that a different user will own, or the ownership of existing documents is transferred from one user to another. I was hoping to use the NodeOwner or DocumentCreatedByUserID, but I do not see how I can set this value through the API.

Example 1:
Node1 (owned by user A)
-- Node2 (created by user B, owned by user A)

Example 2:
Node1 (owned by user A)
-- Node2 (owned by user A)
transfer ownership from user A to user B, so that
Node1 (owned by user B)
-- Node2 (owned by user B)

I am using custom document types for Node1 and Node2, so I can create my own "owner" field if I need to, but I'd prefer to use the existing fields if possible. Any suggestions are appreciated.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/28/2011 2:13:24 AM
   
RE:NodeOwner vs DocumentCreatedByUserID and setting through API
Hi,

you can use this API:

CMS.TreeEngine.TreeNode node = null;
UserInfo ui = UserInfoProvider.GetUserInfo("administrator");
CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider(ui);

node = tree.SelectSingleNode(EF);

node.SetValue("NodeOwner", XY);
node.SetValue("DocumentCreatedByUserID", AB);


Where EF, XY and AB are particular IDs.

Best regards,
Juraj Ondrus

User avatar
Member
Member
CC - 11/28/2011 12:01:15 PM
   
RE:NodeOwner vs DocumentCreatedByUserID and setting through API
Excellent, thank you!

I also found that when creating them, I can use the CMSForm control and set the Owner at that time -- great when creating new items or updating individual ones, but it wasn't going to work for non-UI driven updates.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/29/2011 1:43:04 AM
   
RE:NodeOwner vs DocumentCreatedByUserID and setting through API
Hi,

I am sorry but I am not following your last post, especially the thing with CMSForm - is there something that is still not working for you?

Have you tried using the custom tree node handler when creating/updating the documents/nodes?

Best regards,
Juraj Ondrus

User avatar
Member
Member
CC - 11/29/2011 1:34:04 PM
   
RE:NodeOwner vs DocumentCreatedByUserID and setting through API
Sorry, everything is working fine. I added the comments about CMSForm for anyone else who has similar issues.