how to access the current list name programmaticaly while creating a new list item

Thank you


Answer this question

how to access the current list name programmaticaly while creating a new list item

  • mobigital

    You will need to create a custom EventHandler hooked up to the ItemAdding event. Inside the EventHandler:

    Code Snippet

    public override void ItemAdding(SPItemEventProperties properties)

    {

    SPList list = properties.ListItem.ParentList;

    string listName = list.Title;

    }



  • aashta

    If you have an SPList object called oList that points to the current list, you might be looking for oList.Title.



  • arkiboys

    properties.ListItem returns NULL for me

    we shold do

    properties.OpenWeb().GetList(properties.OpenWeb().url+"ListsName").Items[listItem.Items.Count - 1]["Title"].toString();

    -Sudip


  • how to access the current list name programmaticaly while creating a new list item