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

Hi I have an Infopath form Library and i want to add the forms that are being submitted to a folder in the same library according to the information

I need to do this using an event receiver. Can someone please help with some basic code segement

share|improve this question

So I guess this is what you're looking for:

public override void ItemAdded(SPItemEventProperties properties)
    var myListItem = properties.ListItem;
    var myList = properties.List;

    if (myListItem != null)
        string condition = myListItem["SomeCondition"].ToString();
        if (condition == "x")
            myListItem.File.MoveTo("/ConditionXPath/" + myListItem.File.Name);                       
        else if (condition == "y")
            myListItem.File.MoveTo("/ConditionYPath/" + myListItem.File.Name);       
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.