Specified program requires a newer version of Windows in fieldDeleting event
Hello All I have override the FieldDeleting event. In this event i have deleted some columns and event handlers in SharePoint custom list and .it will delete the columns except the field which we are deleting and it gives me an error Specified program requires a newer version of Windows the code is as public override void FieldDeleting(SPListEventProperties properties) try { if (properties.Field.TypeAsString.ToString() == "RepeatingRows") string columnInfo = properties.Field.GetCustomProperty("DisplayedListBoxProperty").ToString(); XmlDocument doc = new XmlDocument(); //delete sourcelist columns and eventhandlers string sourceSite = doc.SelectSingleNode("/ColumnInfo/SiteURL").InnerText; string[] sourceList = doc.SelectSingleNode("/ColumnInfo/ListColName").InnerText.Split(new string[] { "3B0E1EFA0F23465e8EA4A749F073951E" }, StringSplitOptions.RemoveEmptyEntries); string lookUpColumnName = doc.SelectSingleNode("/ColumnInfo/LookUpColumnName").InnerText; using (SPSite srcSiteCol = new SPSite(sourceSite)) using (SPWeb srcSite = srcSiteCol.OpenWeb()) true; SPList srcList = srcSite.Lists[sourceList[0]]; //code to delete columns //base.DisableEventFiring(); srcList.Fields[lookUpColumnName].Delete(); srcList.Fields[ "MasterListInfo"].Delete(); srcList.Fields[ "GUID_Source"].Delete(); //code to delete the event receivers SPEventReceiverDefinitionCollection srcEventRcvrCol = srcList.EventReceivers; List<SPEventReceiverDefinition> srcListEventsToDelete = new List<SPEventReceiverDefinition>(); foreach (SPEventReceiverDefinition eventReceiver in srcEventRcvrCol) foreach (SPEventReceiverDefinition erSrcList in srcListEventsToDelete) if (erSrcList.Class == "") // base.EnableEventFiring(); // srcList.Update(); } } //delete masterlist columns and eventhandlers XmlNode nodeSummary = doc.SelectSingleNode("/ColumnInfo/SummaryInfos"); //code to delete columns if (nodeSummary != null) foreach (XmlNode node in nodeSummary.ChildNodes) string[] smryColumnName = node.InnerText.Split(new string[] { "3B0E1EFA0F23465e8EA4A749F073951E" }, StringSplitOptions.RemoveEmptyEntries); base.DisableEventFiring(); //properties.List.Update(); base.EnableEventFiring(); base.DisableEventFiring(); properties.List.Fields[ "GUID_Master"].Delete(); base.EnableEventFiring(); //code to delete the event receivers SPEventReceiverDefinitionCollection masterEventRcvrCol = properties.List.EventReceivers; List<SPEventReceiverDefinition> masterListEventsToDelete = new List<SPEventReceiverDefinition>(); foreach (SPEventReceiverDefinition eventReceiver in masterEventRcvrCol) foreach (SPEventReceiverDefinition erMasterList in masterListEventsToDelete) //if (erMasterList.Type == SPEventReceiverType.ItemUpdating || erMasterList.Type == SPEventReceiverType.ItemDeleting) //{ if (erMasterList.Class == "") //} } // base.EnableEventFiring(); } } catch { } // properties.List.Update(); // properties.Field.Delete(); // properties.List.Update(); //base.EnableEventFiring(); } Please suggest any workarroud. It already takes my whole day { erMasterList.Delete(); } { { masterListEventsToDelete.Add(eventReceiver); } } } properties.List.Fields[smryColumnName[2]].Delete(); { { { erSrcList.Delete(); } } { { srcListEventsToDelete.Add(eventReceiver); } { srcSite.AllowUnsafeUpdates = { doc.LoadXml(columnInfo); { {
November 23rd, 2010 2:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics