I have moved document from library to folder within the same document library. For that I have used "Update List Item" action. Now I want to move that document from folder to library again.

1 Answer 1


Let consider Folder name TestDoc and here i am coping a file from source folder FolderA(or from any where in the TestDoc library) to destination folder FolderB

see code below.

public override void ItemUpdated(SPItemEventProperties properties)
    string strItemProperty = properties.ListTitle.ToString();
    if (strItemProperty == "TestDoc")
    SPListItem sourceItem = properties.ListItem;
    SPFolder dFolder = sourceItem.Web.Folders[sourceItem.Web.Url + "/TestDoc/"];
    SPFile sfile = sourceItem.File;
    Stream fileStream = null;
    if (sfile != null)
        fileStream = sfile.OpenBinaryStream();
        dFolder.Files.Add(sourceItem.Web.Url + "/TestDoc/FolderB/" + sourceItem.File.Name, fileStream);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.