Friday, February 20, 2009

Here is a code sample I put together to download a file from a Document Library using SharePoint's Copy web services.

// sharepoint is a web reference that points to http://sharepoint/_vti_bin/copysharepoint.Copy myCopyService = new sharepoint.Copy();myCopyService.Credentials = System.Net.CredentialCache.DefaultCredentials;

// URL to the file you want to downlaodstring copySource = "https://sharepoint/file.doc";

// Define the variables that will store the output from the web service callsharepoint.FieldInformation myFieldInfo = new sharepoint.FieldInformation();sharepoint.FieldInformation[] myFieldInfoArray = { myFieldInfo };byte[] myByteArray;

I have to ask, why are you converting to base64 and then back from base64?I get that it might be nice to demonstrate this for noobs, but as far as I can tell it's a pointless procedure that most people who download this snippet will continue to use time and time again. (As a consultant, I have seen this article cited in 3 different development houses now)

What might have been better to explore is the process for obtaining the filename from the metadata returned, instead of parsing the name from the URL (which would be equally as valid as iterating FieldInfo, find the field with FileLeafRef as the internal name).

From your example one might assume that the filename is always the first element in the field array, where in fact I find that content type id is often first.

So a great post, that can easily mislead. Would have had a far greater contribution if the code comments had included justification for the use of the commented code, rather than being a simple english notation of the code.

Hey there! I am glad to stop by your site and know more aboutcopying services. Keep it up! This is a good read. I will be looking forward to visit your page again and for your other posts as well. Thank you for sharing your thoughts about copying services in your area.The Volume Snapshot Service was first added to Microsoft Windows in Windows XP; this version of VSS is used by NTBackup, however it can only create non-persistent snapshots (a temporary snapshot, usually used for creating a file-based backup or more generally, accessing copies of files that have been locked by applications for editing). NTBackup uses a proprietary BKF file format to store the shadow copies permanently.Quality is how we've grown our business – and our customers' businesses as well. And it's how we can grow your business, too.

GSCopy Pro v6.0 (RoboCopy Alternative) with Open File AgentGSCopyPro is a single command-line tool (CLI) that can copy, replicate and move files from one folder to another. This folder can be on the same machine/ server or another server elsewhere. What makes GSCopyPro stand out from other competitors is the fact it works on 32-bit as well as 64-bit systems and has no restrictions. It can easily be scheduled to run as a scheduled task and fully automated. GSCopyPro also comes with an open file agent which can copy files that are locked/ opened by other processes. This feature is supported in all windows versions from widows XP/ 2003 and later.Go To:>> http://www.gurusquad.com/GSCOPYPRO