SharePoint - Web Service - Asked By Ritu Rani on 10-May-12 01:54 AM


Hi,

1. Which web service is used to create folder in the document library of sharepoint?

2. Which web service is used to upload file in the newly created folder in sharepoint?
Somesh Yadav replied to Ritu Rani on 10-May-12 02:03 AM
hi for first question,
refer this,

http://www.codeproject.com/Articles/19717/Uploading-files-to-the-SharePoint-Document-Library

and for second question try this,

try this one

try
   
{

   
//Copy WebService Settings
   
string webUrl           = "http://sharepointportal.ABC.com/";
   
WSCopy.Copy copyService = new WSCopy.Copy();
    copyService
.Url         = webUrl + "/_vti_bin/copy.asmx";
    copyService
.Credentials = new NetworkCredential("username", "****", "Domain");

   
//Declare and initiates the Copy WebService members for uploading

   
string sourceUrl        = "C:\\Work\\Ticket.Doc";  

   
//Change file name if not exist then create new one    
   
string[] destinationUrl    = { "http://sharepointportal.ABC.com/personal/username/Document Upload/Testing Document/newUpload.Doc" };

   
WSCopy.CopyResult cResult1 = new WSCopy.CopyResult();

   
WSCopy.CopyResult cResult2 = new WSCopy.CopyResult();

   
WSCopy.CopyResult[] cResultArray = { cResult1, cResult2 };

   
WSCopy.FieldInformation fFiledInfo = new WSCopy.FieldInformation();

    fFiledInfo
.DisplayName = "Description";

    fFiledInfo
.Type        = WSCopy.FieldType.Text;

    fFiledInfo
.Value       = "Ticket";

   
WSCopy.FieldInformation[] fFiledInfoArray = { fFiledInfo };

   
FileStream strm = new FileStream(sourceUrl, FileMode.Open, FileAccess.Read);

   
byte[] fileContents = new Byte[strm.Length];

   
byte[] r = new Byte[strm.Length];

   
int ia = strm.Read(fileContents, 0, Convert.ToInt32(strm.Length));
    strm
.Close();
   
//Copy the document from Local to SharePoint

   
uint copyresult = copyService.CopyIntoItems(sourceUrl, destinationUrl, fFiledInfoArray, fileContents, out cResultArray);

   
MessageBox.Show("Suceess");  

 
}
 
catch (Exception ex)    
 
{
   
MessageBox.Show(ex.Message);

 
}
http://stackoverflow.com/a/2162632
Suchit shah replied to Ritu Rani on 10-May-12 02:29 AM

This article describes uploading files in a sequence to a SharePoint Document Library and then using CAML for updating each file's custom meta data. This article also describes how to use the DWS Web Service to create folders/subfolders in a Doc Lib and how to use the List Web Service to upload/update files inside a Doc Lib.

 
http://www.codeproject.com/Articles/19717/Uploading-files-to-the-SharePoint-Document-Library
http://sridharu.blogspot.in/2008/10/createdelete-folers-using-listsasmx-web.html