Quantcast
Channel: SharePoint 2010 – Bobby's SharePoint World
Viewing all articles
Browse latest Browse all 11

Easing the Pain of Document Copy in SharePoint

0
0

I was recently faced with a common challenge of needing to ship a document from one document library to another.  While we all wait for the upcoming, super promising Move & Copy feature (announced during Future of SharePoint), I had to come up with another route that doesn’t involve instructing the end users to use Save As or download a local copy then re-upload to the other library.

For this use case, the request was simple.  Copy a document to a different library.  For that reason, I immediately thought of an old trusted friend, the Send To destination.  Send To does everything that the end users needed, except the function is tucked away in the ribbon, accompanied by a teeny 16×16 icon.

 

This is, after all, a carry-over function from SharePoint 2007, so its lack of prominence is understandable.  In the spirit of making things easier though, I had to do a bit more digging.  As it turns out, the Send To function references a copy.aspx system file, residing in the _layouts folder.  What’s beautiful about this is the URL path, where you could identify the document location and send it anywhere within the web application (and yes, it does go across site collection!)

The formula is as follow:

[YourSourceSite]/_layouts/copy.aspx?SourceUrl=[YourDocument]&FldUrl=[YourTargetLibrary]&Source=[YourSourceLibrary]

As an example, here’s Demo Document being copied from Contoso Site to Demo Site:

http://contoso.com/_layouts/copy.aspx?SourceUrl=http://contoso.com/Shared%20Documents/Demo-Document.docx&FldUrl=http://contoso.com/sites/demo/Shared%20Documents&Source=http://contoso.com/Shared%20Documents

Now, what we can do with this information is to create a Custom Action (otherwise known as Quick Step) in SharePoint Designer (SPD) in order to promote this to our document’s Properties menu/hover card.  Once you connect to your site in SPD and find the Document Library, click on “New” in the “Custom Actions” section.

Give the Custom Action/Quick Step a name then select “Navigate to URL” option.  Copy the URL that you have constructed from the exercise above, except replace The Source URL (i.e.: the link to your document) with {ItemURL}

So the new formula is as follow:

[YourSourceSite]/_layouts/copy.aspx?SourceUrl={ItemUrl}&FldUrl=[YourTargetLibrary]&Source=[YourSourceLibrary]

Using our example, we would post this in SPD:

http://contoso.com/_layouts/copy.aspx?SourceUrl={ItemUrl}&FldUrl=http://contoso.com/sites/demo/Shared%20Documents&Source=http://contoso.com/Shared%20Documents

Once you save your Custom Action, you should see it immediately in the Properties menu/hover card.

Click the Quick Step/Custom Action and it will be like using the Send To.

A few things to note:

  • This process will copy document across libraries in different sites and different site collections (which is pretty cool)
  • It will copy metadata values *but* all columns and/or Content Types in the 2 document libraries must be identical.  Otherwise, you may run the risk of metadata values being left behind.
  • It can only copy 1 document at a time
  • It cannot copy Folder … but who wants to use folder anyways? =)
  • In my brief testing with the SharePoint Modern Library (i.e.: New Experience mode currently in SharePoint Online First Release, at the time this post was written), the Send To function does NOT work. The Copy page appears but clicking OK doesn’t actually do anything.
    That being said, this post would be less relevant after the new Move & Copy feature has been released for SharePoint 2016 and SharePoint Online (which should include move/copy function to other document libraries and OneDrive For Business)


Viewing all articles
Browse latest Browse all 11

Latest Images

Trending Articles





Latest Images