After working with Kentico for some time, I’ve slowly developed a few little tools to help migrate information from our old site to the new Kentico framework.
One of the things that’s a little time consuming in Kentico is creating documents. I’ve decided to use a custom document type for a particular type of content on our new site. The data for this new document type is in a bunch of different tables in the old website and I needed a way to get all that information into the Kentico content tree, and fast.
So… I created a module to do this. It’s kind of simple and doesn’t look too flash but it works (if you follow the rules).
It takes a spreadsheet, uploads it to a temp folder and then creates documents at the specified path in the tree. If you need it, it’s yours to do with as you see fit.
BTW: No warranty provided on this of course.
The code is pretty simple:
1: While dsImport.Read
2: ListBox1.Items.Add(dsImport.Item(0).ToString)
3: 'add documents
4:
5: nodTemp = New CMS.TreeEngine.TreeNode("NAS.Card")
6: nodTemp.NodeName = dsImport.Item("NodeName").ToString
7: nodTemp.NodeAlias = dsImport.Item("NodeName").ToString
8:
9: For i = 0 To strCols.Length - 1
10: nodTemp.SetValue(strCols(I), dsImport.Item(strCols(I)))
11: Next
12:
13: nodTemp.DocumentCulture = "en-au"
14: nodTemp.Insert(parent.NodeID)
15: End While
The form collects a few things like the document type to create and the name of the columns in the spreadsheet to map to fields in the kentico document. Looking at this at the moment I have left the document type hard coded, but you could easily change this to be driven from the form.
Additionally you’ll see at line 9 I loop through an array, this is derived from a comma separated list of column names to get from the excel sheet. Let me know if you use it, just out of interest.
















Thanks a lot for sharing your solution. I am in the middle of developing a large site with Kentico as well, and this has given me some great ideas on how to get the massive amount of data into the tree after the containers are all built.
Hi, Im new with Kentico, I have created the “GetTime” module that is inside the Developer Guide and I can see “MyModule” under CMS Desk - Tools but I dont know how to use it… I mean how can I add my module to a page in my site? I really appreciate your help.
Hi
I think you might have mis-understood what a module is all about. By design it’s a CMS tool, not something you would actually add to your site (for the public to see). Instead you should have a look at creating a user control that inherits the kentico framework and then adding that as a webpart that you can then put on your site.
Head over to http://devnet.kentico.com and have a look.
Jay