I am getting a warning from the spdisposecheck in one method I executed on the feature activated event.
private void CopyAttendees(SPWeb currentWeb)
{
try
{
SPWeb parentWeb = currentWeb.ParentWeb;
SPList parentWebAttendeeList = parentWeb.GetSafeListByName(MeetingsCommon.Constants.LISTS_ATTENDEES_NAME);
SPList currentWebAttendeeList = currentWeb.GetSafeListByName(MeetingsCommon.Constants.LISTS_ATTENDEES_NAME);
foreach (SPListItem itemParentWebAttendeeList in parentWebAttendeeList.Items)
{
SPListItem itemCurrentWebAttendeeList = currentWebAttendeeList.Items.Add();
itemParentWebAttendeeList.MapFieldValue(MeetingsCommon.Constants.FIELDS_TEXT_TITLE_NAME, itemCurrentWebAttendeeList);
itemParentWebAttendeeList.MapFieldValue(MeetingsCommon.Constants.FIELDS_ATTENDEEROLE_NAME, itemCurrentWebAttendeeList);
itemParentWebAttendeeList.MapFieldValue(MeetingsCommon.Constants.FIELDS_ATTENDEEATTENDANCE_NAME, itemCurrentWebAttendeeList);
itemCurrentWebAttendeeList.SystemUpdate();
}
}
catch (Exception ex)
{
throw;
}
}
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
Logger.LogDebug("NLMeetingsSiteConfigNLBDMeetingEventReceiver", "FeatureActivated(SPFeatureReceiverProperties properties)", "BEGIN");
try
{
string siteUrl = (properties.Feature.Parent as SPWeb).Url;
SPSecurity.RunWithElevatedPrivileges(() =>
{
using (SPSite currentSite = new SPSite(siteUrl))
{
using (SPWeb currentWeb = currentSite.OpenWeb())
{
SetCustomMasterPage(currentWeb);
ModifyHomePage(currentWeb);
CopyAttendees(currentWeb);
SetSecurity(currentWeb);
ConfigureWeb(currentWeb);
}
}
}
}
}