Creating content via API

I created a utility that bulk loads content from an Excel spreadsheet into WCM. When I run the code to create a new folder, the folder doesn't always show up on the Manage Content screen.

The code to create the folder is based on this sample code provided by Eric in 2009: http://www.imiscommunity.com/how_to_programmatically_create_content

When I inspect the DocumentMain and Hierarchy tables in the database, everything looks exactly the same as folders that I created manually with the WCM tool:

ParentHierarchyKey DocumentTypeCode DocumentStatusCode DocumentName DocumentDescription AlternateName
63F4FB6D-88F2-412F-AF7D-07653BD56A96 CFL 40 Board NULL Board
63F4FB6D-88F2-412F-AF7D-07653BD56A96 CFL 40 BoardTest NULL BoardTest
63F4FB6D-88F2-412F-AF7D-07653BD56A96 CFL 40 SC NULL SC

The first two rows were created with the WCM admin website, and the third was created from code. Everything looks the same, but the one created from code doesn't appear in the folder at all.

Any ideas?? Is there another table that I need to check?

Thanks,
James

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Perhaps I spoke too soon. I

Perhaps I spoke too soon. I think there was something corrupted on the root folder where I was trying to add the sub-folders, because the code works fine when I create new root folders and sub-folders.

So I think this is a non-issue (for now anyway).

Cheers,
James

Turns out the folder is only

Turns out the folder is only created successfully if there is content added into it (based on the example code I provided above).

There must be a way to create a folder programmatically without adding content to it. Has anyone had to do this? I'll see if I can figure out how ASI did it...

Weird

Hi James,

It's strange that the example code isn't working for you - that's essentially the same code we use within iMIS and I've never know there to be any issues with it. Also, an equivalent folder for each content folder will not be created on the hard drive until the content folder has published content in it. Is the content folder not even showing up in the UI? You might check that the SortOrder on your new content folder is greater than the SortOrder on it's parent hierarchy.

Good luck,
Courtney Robertson