I understand that a list and a library are two different things... But I have a project tracker which is a list. I would like to move it to a different site and as a library. Is there any way I can move this data ? Without having to create a library all over again ? Is there any option to sync a list in one site to a library in another site ? Kindly help..
1 Answer
Libraries are associated with documents, it's required to have a document in a library. If you aren't bringing over a document, there is no reason to use a library. Otherwise if you want to move the items over to a different list, the idea is to use powershell:
$sourceweb = get-spweb http://sourceweb
$destinationweb = get-spweb http://destinationweb
$sourcelist = $sourceweb.Lists["List Name"]
$destinationlist = $destinationweb.Lists["New List Name"]
foreach($item in $sourcelist.Items){
$newitem = $destinationlist.Items.Add();
$newitem["Field"] = $item["Field"]
$newitem["Field2"] = $item["Field2"]
$newitem.Update()
}
$sourceweb.Dispose()
$destinationweb.Dispose()
-
Thanks for this info... But to be more precise.. I want the tracker which is a list to moved to a library.. There are many other documents related to the same project in the library and tracker which is now in list must be in the library and its in a different site...any means by which I can bulk load the data from a list in one site to a library in another site ?? Or by using powershell can the same logic be applied ?– kanikaCommented Sep 27, 2014 at 5:20
-
does this script work withing same site collection lists. for moving data? Commented Sep 27, 2014 at 6:20
-
Where are your documents stored? What I'm getting at is every "library item" is a document, not a list item. The metadata is about the document. You are planning to have a document for every list item? I think your best bet is to just create a document library that houses these documents, and if you want you can link list items to the document that it relates to.– MikeCommented Sep 29, 2014 at 13:51