SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Normally we delete a List item using following code,

using (SPSite site = new SPSite("http:web1/default.aspx"))
                using (SPWeb web = site.OpenWeb())
                    web.AllowUnsafeUpdates = true;

                    SPList list = web.Lists["MyList"];

                    SPListItemCollection listItems = list.Items;

                    foreach (SPListItem item in listItems)
                            if (item.DisplayName == "HyperLink")

                    web.AllowUnsafeUpdates = false;

I want to compare a HyperLink or Name/Title of HyperLink to the item and delete it, instead of title or DisplayName as its always coming as "(no title)" while debugging.

I Know I need to create an XML node in order to do this but any other way, tutorial or how to do it using XML node will be appreciated.


share|improve this question
up vote 0 down vote accepted

Because SharePoint let User to leave Title Field empty, so I created a Added List Item Event receiver that takes name of Item and assign its value to Title field. hence I didn't needed to delete a item using hyper link any more.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.