I have requirement to copy items from one SPList to another,
Here is the code which is not working:
public void CopyList(SPList src)
{
//Copy items from source List to Destination List
foreach (SPListItem item in src.Items)
{
if(isUnique(item.UniqueId))
{
foreach (SPField field in src.Fields)
{
try
{
if (!field.ReadOnlyField)
newDestItem = DestinationList.Items.Add();
newDestItem[field.Id] = item[field.Id];
newDestItem.Update();
}
catch (Exception ex)
{
ex.ToString();
}
}
//newDestItem["wrkspace"] = src.ParentWeb.Name;
// newDestItem.Update();
}
DestinationList.Update();
}
// DestinationList.Update();
}