Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Using API to create documents in checked-out status. View modes: 
User avatar
Member
Member
sfbrown-hcso.tampa.fl - 3/11/2011 2:52:05 PM
   
Using API to create documents in checked-out status.
Having trouble finding a way to do this...

I've imported large numbers of files into Kentico in the past using the API to pull archive information from old sites into a new Intranet. However, I'm having trouble with a specific requirement from my boss. He wants...

* Import a large number of files (500+) from several folders into a structure into Kentico.
* When the documents are created in Kentico, he wants them in a status of checked out to him (not published.)

I know how to do the basic stuff of reading the source directories, creating the node and pushing the documents to Kentico. What I can't figure out is how when the document is first created to have it be checked out to him and not published.

Any suggestions?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/14/2011 2:23:02 PM
   
RE:Using API to create documents in checked-out status.
Hi,

You need to setup workflow for those documents first. Here you can find a complete example how to manage documents with workflow in API. In your case you need to use code like this:

// Check out the document

VersionManager vm = new VersionManager(tree);

vm.CheckOut(node);


Best regards,
Juraj Ondrus

User avatar
Member
Member
sfbrown-hcso.tampa.fl - 3/15/2011 9:00:35 AM
   
RE:Using API to create documents in checked-out status.
Yeah, I know how to do a simple checkout. My question was is there a way to check out to a particular user other than what the program iis running under?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/15/2011 5:09:44 PM
   
RE:Using API to create documents in checked-out status.
Hi,

as you can see from the API examples, the administrator user is used to set the UserInfo object.

One option is to set another user here or set the "DocumentCheckedOutByUserID" property to given user ID.

Best regards,
Juraj Ondrus

User avatar
Member
Member
sfbrown-hcso.tampa.fl - 3/16/2011 12:23:51 PM
   
RE:Using API to create documents in checked-out status.
Thanks, I had actually found the UserInfo at a later time and had not noticed it in the code sample. The way I got the second part to work was to do a checkout but passing a false flag on published so I now have the results I needed. Thanks again.