0

Migrating Lists from SharePoint 2007 to 2013 Using Command Line

Launch SharePoint Blog in 3…2…1

Well, this is my very first blog…ever (we won’t count my 2004 MySpace blog which illustrated my love of hardcore metal bands and how emo I was). I recently jumped head first into a career managing SharePoint content for a large Army installation and I’ve found that although SharePoint is a powerful tool, I want more out of it.  I want it to look cooler and be more intuitive for our users.  Of course, I also want to make my life easier when it comes to content management and administration.  Some of the out-of-the-box solutions, or OOB as the techies call it, usually don’t fully meet our requirements.

I know some people consider SharePoint Designer OOB because it’s free to download, but for the purpose of my blog I won’t be referring to it that way for two reasons: it requires additional installation and more importantly, the 2013 version doesn’t have design view which makes it pretty painful to do some basic things, like change the size of a list column or quickly see the outcome of changes you’ve made in code.

When I’m looking for something that isn’t OOB, I turn to trusty Google.  There’s a wealth of information out there, but I guess since I’m new to SharePoint, I don’t quite know all of the lingo and I usually don’t get the parts where the writer expects me to read between the lines.  My hope is that my blog will help other users like myself, who aren’t super familiar with all of the awesome tools available and what they have to offer, e.g., SharePoint Designer, jQuery, or InfoPath.  I also hit up our Software Engineering Group when they have time to explain things I don’t understand.  Imagine the types of questions a person with a degree in Health Science would need to ask to understand the wide world of SharePoint.  At the end of the day, I just want to share what I learn in a fashion that even SharePoint newbies can use.

The first solution I want to share involves using command line to migrate lists with content from 2007 to 2013…eek! I know it can seem intimidating for beginners like me, but I assure you that the dated, black window can become your best friend.  You may be wondering why we didn’t just purchase a migration tool and the reason is because most of the content on our 2007 instance of SP is junk and we really want to start fresh on our new environment.  However, we still have a few large lists that would take entirely too long to copy over manually.  Oh yeah…and this is free, which is always a plus.

For any advanced users reading my blog, bear with me on all of the minute details.  You can skip the steps that you already know and feel free to poke fun at my lack of technical vernacular (or give me some pointers).

Using Cmd Line to Migrate Lists with Content

Overview: This solution allows you to convert a 2007 list template (with content) into a version that can be uploaded into 2013.  You just need to create a .ddf file (A Diamond Directive File is a text file that contains information needed to help you compress your files into a CAB (Cabinet) file) and run a few commands in CMD line.

Limitations: As far as I know, this solution won’t work for lists containing over 5000 items (the 2013 limit) or lists with attachments as is.  My software developer friend says there is a way though so if I get it out of him, I will totally share.  I have not tried it for 2010 to 2013 content migration.

  1. Create a folder on your desktop – NOSPACES in the folder name. You are going to be using this folder to save and convert a few files. Think of it as your data transfer hub.
  2. Open notepad. Copy and paste this text inside:

.OPTION EXPLICIT

.Set CabinetNameTemplate=TemplateName.stp
.set DiskDirectoryTemplate=CDROM
.Set CompressionType=MSZIP
.Set UniqueFiles=”ON”
.Set Cabinet=on
.Set DiskDirectory1=.
.Set CabinetFileCountThreshold=0
.Set FolderFileCountThreshold=0
.Set FolderSizeThreshold=0
.Set MaxCabinetSize=0
.Set MaxDiskFileCount=0
.Set MaxDiskSize=0

manifest.xml

3. Save the file to the folder you created in step one as “files” and change the file extension from .txt to .ddf

If you don’t see .txt next to the file name, go into the folder options either under Tools or Organize and uncheck the box that says “Hide extensions for known file types.”  Then you can change the .txt to .ddf inside the folder.

4. Go to the list you want to move to SharePoint, select the option “Save list as template” in the list settings and save it to the folder you created on your desktop.

5. Now it’s time to open CMD line…woo hoo!  Click on your Start button on the lower left of your desktop and type “cmd” into the search field.  The window will automatically open (it’s black with white letters and looks like a super old school computer program).

6. You will be using CMD line to generate another file needed to translate your template so it will work in 2013.  So you need to tell CMD (I’m just going to call it that now) where that folder is by changing the directory.  Copy the folder location and paste it after the letters “cd”  Here is my example:

cd C:\Users\ashley.bedwell\Desktop\SP_Acronyms

CMD does not let you use keyboard shortcuts (like Ctrl + V to paste).  You need to type the letters cd, hit the spacebar once, and right-click to paste the folder address you copied.

7. Now you are going to generate what is called a manifest file using the 2007 list template you saved (the one you are trying to migrate to 2013).  To do that you need to type the following command using the template file name:

expand -r TemplateName.stp C:\Users\ashley.bedwell\Desktop\SP_Acronyms\TemplateName

I would recommend typing out the whole command in notepad so that you can just right-click into CMD and paste it.

8. Now you should notice that there is a manifest.xml file in your folder.  You need to make a minor change to that file, so right-click, edit, and change the 3 to a 4 in this tag: <productversion>3</productversion>.

If you have a fancy editor, like Visual Studio or Notepad ++, it will be easy to find that line of code but no worries if you’re just working with regular notepad.  In that case hit Ctrl+F (hold those two buttons down at the same) and you can search for “productversion” to find that part of the code.  Simply change the 3 to a 4 and save it.

If running that “expand” command generated more files than just the manifest.xml file, the file names will need to be added to the bottom of the .ddf file you created in step 2.

9. Right-click the .ddf file and select edit to change the cabinetnametemplate filename to what you want the new .stp file to be called (maybe just add “NEW” to the title or “2013”).

10. At last, run this last command in CMD and voila!  You have your new file that you can upload as a template into 2013:

makecab /f files.ddf

The makecab and expand files needed to run those commands should already be on your computer.  If you get a return in CMD saying that the expand or makecab commands aren’t recognized that means that you don’t have them.  Unfortunately, I could not find a link where you can download them quickly online.

11. Go to the 2013 site you would like to upload your list, click on Site Settings, List Templates under the Web Designer Galleries heading.  Click on the Files ribbon at the top and select Upload Document.  Navigate to the new file your folder and select the new .stp template file you created.

12. Now you can add that template to your site by clicking on Site Contents, add an app and find the template you uploaded.

I don’t know how many users will ever need to migrate a list from 2007 to 2013 (we were stuck in the Stone Age), but I will be happy if this saves one person any amount of time.  Until my next post, check out this awesome Tabbed Web Parts solution for 2013:

http://summit7systems.com/tabbed-web-parts-in-sharepoint-2013-office-365/

It’s really clean and saves a ton of space on your team sites, so kudos to Mark Rackley for developing such a great tool and sharing it with everyone!!