SharePoint 2010 ECMAscript – Copy\Move files to another document library
In this post we see a detail example of creating a Ribbon button which when clicked will copy the selected documents from a document library to a pre-defined library (destination library) using ECMAScript.
The steps that user will follow to Copy the the files -
1. Select documents in document library.
2. Click on Copy Documents button in “Manage group” of ribbon.
3. User will be notified via notification that the selected files has been moved.
Steps -
1. Open Visual studio 2010 and create a Empty SharePoint project.
2. Deploy as a sandbox solution.
3. Right click on the Feature and click “Add Feature”

3. Right click on the project and add a new “Empty Element” item.

4. Now, we will add the code for creating a custom button (under Documents tab in the Manage group) which will get displayed in your document library. Also in the “commandAction” you will see the ECMAScript needed for copying the selected documents to the destination library. In this example destination library is hardcoded but you can always create a custom modal dialog for asking user about the destination library.
The button will look something like below -

See the complete code and notifications in Part 2 >>





Pingback: Programmatically get selected documents from sharepoint 2010 document library : Learning SharePoint