private static void SnapshotToXLS(SPList list, SPList docLib)
{
try
{
SPListItemCollection listItems = list.GetItems(list.Views["View"]);
DataTable items = listItems.GetDataTable();
string filename = string.Format("{0}.xml", DateTime.Now.ToString("yyyymmddhhmmss"));
MemoryStream contents = new MemoryStream();
items.WriteXml(contents);
SPFile file = docLib.RootFolder.Files.Add(filename, contents);
}
No comments:
Post a Comment