In trying to dynamically detect the document library a user has selected and working in, I did this previously within an ItemAdded event like the code below.
SPWeb currentWeb = properties.Web; SPListItem listItem = properties.ListItem; SPList myList = listItem.ParentList; SPFolder mylibrary = myList.RootFolder;
How do I get the same thing done in an ItemAdding event? I am assuming because ItemAdding a synchronous event, that has something to do with why the same approach doesn't work. How do I get to do the same thing in ItemAdding event? What I am trying to accomplish is this...when a user uploads a document into a document library, I want to use an ItemAdding event to ask the user for some metadata input before the document is added to the library. To get this done, i want to dynamically detect what document library they are uploading the document into.
If I tried to use the same idea as I did above, I get a NullReferenceException (Object reference not set to an instance of an object.) at this point
SPList myList = listItem.ParentList;
How do I get this done? I really appreciate the help...
Thanks