I have 2 identical Survey lists both created from the same template.
In my event handler I want to copy an item from Survey A to Survey B
when the user fills out the survey and submits it. My event handler
will successfully create a new item in Survey B when Survey A is
submited but I can't seem to copy the actual Survey A item with its
results. Here's my code below...
public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
SPSite siteCollection = null;
SPWeb web = null;
SPList survey = null;
try
{
siteCollection = new SPSite("MY_SITE");
web = siteCollection.OpenWeb();
survey = web.Lists["Private Survey"];
SPListItem listItem = survey.Items.Add();
//Here's where I try to copy one item to the other
listItem = properties.ListItem;
listItem.Update();
}
catch (Exception e)
{
}
finally
{
web.Dispose();
siteCollection.Dispose();
}
}