Judging by the SharePoint tag, I assume that you want to ask: "How to copy a SharePoint list (SPList) programmatically?"
Without testing it (or even trying to compile it), I would do something like:
SPWeb web;
SPList sourceList = web.Lists["nameOfSourceList"];
sourceList.SaveAsTemplate("templateFNM.stp", "tempList", "tempListDescription",
true );
SPListTemplate template = web.ListTemplates["tempList"];
web.Lists.Add("newListName", "newListDescription", template);
web.Update();
SPList newList = web.Lists["newListName"];
In addition, here is a link to a blog post that achieves the same use of web applications.
And finally, a tip: you will get better search results if you use "programmatically" instead of "code wise".
Hope this helps.
source
share