Thursday, January 16, 2014

Export - Import Sharepoint List 2007

How to Import and Export SharePoint 2007 Task List with Attachments

 
So first the commands you will run are simple STSADM commands on your SharePoint 2007 server. To run these commands you have to be an admin on the server and an admin for the sites you are exporting and importing the Task List to. There are two commands you will use they are listed below:
Export Command
stsadm -o gl-exportlist -url "http://yoursite/Documents/TaskList/AllItems.aspx" -filename "c:\docs" -includeusersecurity -versions 4 -nofilecompression
Import Command
stsadm -o gl-importlist -url "http://yoursite/" -filename "c:\docs" -includeusersecurity -updateversions 2 -nofilecompression -retargetlinks -sourceurl http://yoursite/Documents/TaskList/AllItems.aspx
You of course have to change the URLS to match your sites and the file names and locations to where you want to save the file. These two commands work perfectly to move a task list from one site to another; you can even move them cross domain or from one farm to another. The only catch is you have to install a WSP file that was written to make these two commands work. Without installing the WSP files these two commands do nothing other than come back with an error. The WSP file you have to install is just an extension of the STSADM commands that was written specifically for these two commands.
So to download and install the WSP file so that you can use the commands to move the Task List and attachments follow these steps:
Download the WSP file HERE
Put the file on the server you want to deploy the solution on (the server where the task list is located)
Open a command prompt to STSADM (I wrote an article how to add STSADM to your path, it might help)
Run the command stsadm -o addsolution -filename Lapointe.SharePoint.STSADM.Commands.wsp (make sure you are in the directory where you put the WSP file on the server, in my case C:\test)
Run the command stsadm -o deploysolution -name Lapointe.SharePoint.STSADM.Commands.wsp -immediate -allowgacdeployment
Run the command stsadm -o execadmsvcjobs
Once you have completed the commands and it didn't throw any errors then you are now ready to run the commands to export your Task List. To do this, follow these steps:
Login to the server you need to export the task list from (should be same server you just deployed the WSP file to)
Open a command prompt to STSADM (I wrote an article how to add STSADM to your path, it might help)
Run the command stsadm -o gl-exportlist -url "http://yoursite/Documents/TaskList/AllItems.aspx" -filename "c:\docs" -includeusersecurity -versions 4 -nofilecompression
Now if this completed with no errors you should be able to go to the file location C:\docs and see all of the files for the task list. Now you can go to any SharePoint Farm in any environment and import this task list with all of its attachments. Remember if you are importing the Task List to a different server you have to run through the install of the WSP file again on the new server before you can import the Task List and its attachments.
To import the task list follow these steps:
First if it's a new server make sure you go back through the WSP install steps above
Copy the files from where ever you exported the list ("C:\docs" was my example) to the new server
Open a command prompt to STSADM (I wrote an article how to add STSADM to your path, it might help)
Run the command stsadm -o gl-importlist -url "http://yoursite/" -filename "c:\docs" -includeusersecurity -updateversions 2 -nofilecompression -retargetlinks -sourceurl http://yoursite/Documents/TaskList/AllItems.aspx
Now you can go to the site where you imported the task list and all of your tasks should be there and more importantly all of your attachments will be there as well. I hope this guide helps you to get around the issue of exporting and importing Task Lists where the attachments don't import/export properly.
Ref : http://voices.yahoo.com/how-import-export-sharepoint-7367026.html

No comments:

Post a Comment