Posts

Showing posts from January, 2010

How to Copy/Upload Files into SharePoint Document Library

We may have to add a service reference to SharePoint Copy Web Service [ http://SharePointSite/_vti_bin/copy.asmx ] before coding this. Here are two functions to copy/upload files into SharePoint Document Library. To call the functions, we may have to use following syntaxes: CopyFromFileToSP("ASLog.txt", "C:\\ASLog.txt", " http://dcftsd1/Policy/ASLog.txt "); CopyFromSPtoSP(" http://dcftsd1/Policy/Book1.xls ", " http://dcftsd1/Policy/Book3.xls "); //Function to Copy a File from One Document Library to Another Document Library private void copyFromSPtoSP(string _SourceFile,string _DestFile) { try { SPCopyService.FieldInformation myFieldInfo = new SPCopyService.FieldInformation(); SPCopyService.FieldInformation[] myFieldInfoArray = { myFieldInfo }; SPCopyService.CopyResult myCopyResult1 = new SPCopyService.CopyResult(); SPCopyService.CopyResult myCopyResult2 = new SPCopyService.CopyResult(); SPCopyService.CopyResult[] myCopyResultArray = { ...