lunedì 20 maggio 2013

Copying SharePoint documents


Introduction

Working with SharePoint, it is often failed intuitive functionality to copy a document from one document library to another, or simply create a copy with a different name.


Building the Sample

The solution was implemented with Visual Studio 2012 and ready to be deployed as a site (SPWeb) feature by using the "Deploy" command in visual studio or by using the WSP that already exists in the solution.
The solution was created for SharePoint 2013 with target framework 4.5.

Description
Copy a file by using the SharePoint server object model is a very quick thing.Just one line of code.
C#
sourceFile.CopyTo(lblFullUrl.Text);
What I tried to do is make the intuitive and simple operation even at the UI side, creating a navigation tree that would allow the user to navigate the structure of your site and select the destination folder.
Everything starts from a custom action associated with the Document content type that allows, by selecting the menu item on a single item, to display an application page that will guide the user to the copy of the selected file.

    At this point, you should see an application page that will allow you to copy the selected file, using an intuitive navigation menu.



    By filling the field "Destination file name" and using the "Ok" button, the system will copy the file to the specified location.

    Of course this is just an example and you need to strengthening a lot before you can release in a production environment.

    You can download this solution from here.

    Nessun commento:

    Posta un commento