API
Version 7.x > API > Unable to locate a treenode with APU when workflow is ON. View modes: 
User avatar
Member
Member
seanbun - 1/30/2014 5:45:25 PM
   
Unable to locate a treenode with APU when workflow is ON.
Hi,

I am working a project and bring content for v6 to v7. Unfortunately, we cannot upgrade the instance directly and migrating the content thru api.

I created a small external application to do the migration. I needed to locate a parent node to put the content in. I use below code to find the parent node on the NEW kentico instance. It was fine when I turn off the version/workflow on the content tree. But I turned ON the workflow and included all doucments in the scope.I found an issue and tree.selectSingleNode or selectNodes always return null.

CMSContext.Init();
var userinfo = UserInfoProvider.GetUserInfo("administrator");
var tree = new TreeProvider(userinfo);
.....
var parentNode = tree.SelectSingleNode(SITE_NAME, parentNodePath, "en-au");

Again the code to try to locate the node on the new instance but fail, what do I miss to handle the workflow?

Thanks

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 1/30/2014 8:38:32 PM
   
RE:Unable to locate a treenode with APU when workflow is ON.
Hi,

You are supposed to use a different API methods when you are working with the documents under workflow.

For more details please take a look at the Developers guide - API Examples:
Workflow Basics API Examples Managing Documents

Best Regards,
Martin Danko