Try this code -
I added a web reference to
http://servername/_vti_bin/copy.asmx
where server should be replaced by sharepoint server name
Suppose, I give it a name CopyReference
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Asmx
{
class Program
{
static void Main(string[] args)
{
CopyReference.Copy copyService = new CopyReference.Copy();
copyService.Url = @"http://server/_vti_bin/copy.asmx"; // change server to your sharepoint server
copyService.Credentials = new NetworkCredential("username", "password");
string copySource = @"http://server/Shared Documents/document1.docx"; //location of the file on server
Console.WriteLine("Here");
CopyReference.FieldInformation myFieldInfo = new CopyReference.FieldInformation();
CopyReference.FieldInformation[] myFieldInfoArray = { myFieldInfo };
byte[] myByteArray;
Console.WriteLine("Here");
copyService.GetItem(copySource, out myFieldInfoArray, out myByteArray);
Console.WriteLine(myByteArray.ToString());
Console.ReadKey();
}
}
}