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

How to move an item from custom list root location to sub folder programmatically (in Event Receiver (ItemAdded))?

share|improve this question
up vote 1 down vote accepted

You can identify a custom list's root folder using SPList.Rootfolder property and corresponding subfolders could be accessed using SPList.Rootfolder.SubFolders[index].

While adding the list item, make sure that it is added to the correct folder path.

SPListItem listitem = list.Items.Add(folder.ServerRelativeURL,SpFileSystemObjectType.File)

Sample code might look like this.

     using (SPWeb web = properties.OpenWeb())
           SPList list = web.Lists["Test"];

           if (properties.List.Title == list.Title)
               foreach (SPFolder folder in properties.List.RootFolder.SubFolders)
                   if (folder.Name == "Specific Folder Name")
                       SPListItem listItem = list.Items.Add(folder.ServerRelativeUrl, SPFileSystemObjectType.File);
                       listItem["FieldName"] = properties.ListItem["FieldName"];

share|improve this answer

This solution allow you to move to any folder in same or different list

share|improve this answer
We require relevant answers and disclosure of any affiliation with products or websites. Please see May I promote products or websites I am affiliated with here? for guidelines. – SPDoctor Jul 5 '12 at 22:30

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.