Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer

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);       
        }
        else
        {
            //..
        }                                
    }           
}
share|improve this answer
add comment

Your Answer

 
discard

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.