This is how you can copy selected documents by clicking on a ribbon button to destination Library. You need to create a custom action which will get the selected item ids and pass them to a pop-up page. The page may contain a textbox for entering the destination Url and a submit button. The button click handler will read the selected items and copy them to destination library. Here is an example of the Custom Action:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="COB.SharePoint.Ribbon.NewControlInExistingGroup"
Location="CommandUI.Ribbon.ListView"
RegistrationType="List"
RegistrationId="100">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Workflow.Controls._children">
<Button Id="COB.SharePoint.Ribbon.NewControlInExistingGroup.Notify"
Command="COB.Command.NewControlInExistingGroup.Notify"
Sequence="21"
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
Image16by16Top="-48" Image16by16Left="-240"
Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
Image32by32Top="-448" Image32by32Left="-384"
Description="Uses the notification area to display a message."
LabelText="Approve/Reject Selection"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="COB.Command.NewControlInExistingGroup.Notify"
EnabledScript="javascript:enableApprovalAll();"
CommandAction="javascript: showApproveAll(); "/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction
Id="COB.Command.NewControlInExistingGroup.Notify.Script"
Location="ScriptLink"
ScriptSrc ="/_layouts/SharePoint.ApproveRejectTest/Scripts/ApproveReject.js"/>
</Elements>
This is the code in JS file which gets selected item ids and passes them to a popup page. Note that in the example the page is stored in /_layouts
folder. However, since you want a sandboxed solution you will need to put the page in a module. And finally the code to copy documents need to be written in the code behind of the page.
function showApproveAll() {
var ctx = new SP.ClientContext.get_current();
var ItemIds = "";
//get current list id
var listId = SP.ListOperation.Selection.getSelectedList();
//get all selected list items
var selectedItems = SP.ListOperation.Selection.getSelectedItems(ctx);
//collect selected item ids
for (var i = 0; i < selectedItems.length; i++) {
ItemIds += selectedItems[i].id + ",";
}
//prepare cutom approval page with listid
//and selected item ids passed in querystring
var pageUrl = SP.Utilities.Utility.getLayoutsPageUrl(
'/SharePoint.ApproveRejectTest/ApproveAll.aspx?ids=' + ItemIds + '&listid=' + listId);
var options = SP.UI.$create_DialogOptions();
options.width = 420;
options.height = 250;
options.url = pageUrl;
options.dialogReturnValueCallback = Function.createDelegate(null, OnDialogClose);
SP.UI.ModalDialog.showModalDialog(options);
}
//used to determine whether the 'approve/reject selection'
//ribbon will be enalbed or disabled
function enableApprovalAll() {
var ctx = new SP.ClientContext.get_current();
return SP.ListOperation.Selection.getSelectedItems(ctx).length > 1;
}
//called on dialog closed
function OnDialogClose(result, target) {
//if ok button is clicked in dialog, reload the grid.
if (result == SP.UI.DialogResult.OK) {
location.reload(true);
}
}
The following reference shows how documents can be approved/rejected in bulk. This is not about copying documents. However, this will help you achieve what you want as you will need to apply the same logic in getting documents copied.
http://ranaictiu-technicalblog.blogspot.in/2011/05/sharepoint-2010-approvereject-multiple.html