I have a provider hosted SharePoint app. I need to add a custom action item "copy" in the context menu of a list item. On click of copy I should get a duplicate of that item at the bottom in the same list in SharePoint online. Any suggestions?

  • You can create a workflow using sharepont designer to copy item and then use that workflow as custom action.
    – P S
    Commented Mar 17, 2016 at 5:00
  • Thank you for the reply. I have to do it without workflow
    – MJaiswal
    Commented Mar 17, 2016 at 9:36

1 Answer 1


I got the solution:

// get the file
                File file = sourceItem.File;

                char[] chars = { '.' };
                var fileName = file.Name.Split(chars);
                // build destination url
                string locationUrl = web.ServerRelativeUrl.TrimEnd('/') + "/" + destinationList.Title + "/" + fileName[0] + "-Copy." + fileName[1];

                // read the file, copy the content to new file at new location
                file.CopyTo(locationUrl, true);

The above code would do the work !

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.