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

enter code hereI have a small issue, I cannot seems to find a way to find out what time of item is being added, so i have a method AddingItem and here i need to know is this item a FOLDER or just some other type of item.

Is there a way to do that, i suppose there is, but can anyone provide me some useful info?

public override void ItemAdding(SPItemEventProperties properties)
            //find if it is Folder that is being created

            // do some stuff

            // exit            


I tried: properties.ListItem.File But it returns null, how can i then know if it is folder or is it something else.

share|improve this question

Non of above answers will work as you can't get Properties.Item in Item Adding event.

Since its Item Adding you can use properties.AfterUrlto get item's name

public override void ItemAdding(SPItemEventProperties properties)

                string ItemName = properties.AfterUrl.ToString();

Once you get item's name check if it has an extension if it does then its an Item otherwise a folder.

You can use String.Split('.') to get extension of item, it might throw an exception though you be prepared to catch it.

share|improve this answer

You can use FileSystemObjectType property of the item to determine the type.

In order to access SPListItem object in the event receiver, use properties.ListItem

share|improve this answer
+1. Nice. Didn't know this. Does this work with list item's that are of a content type that has inherited 'Folder'? – JᴀʏMᴇᴇ Mar 1 '13 at 15:06
is this for SharePoint 2010? in SharePoint 2007, there is nothing like that :( – Shkipper Mar 1 '13 at 15:24
According to MSDN, the property should be available in 2007 (WSS 3.0 to be more precise):… – Tim Mar 1 '13 at 15:27

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.