I am new to Sharepoint Portal Server 2007 and WSS 3.0. But the task I want to do with Sharepoint is very simple. I want to programmatically add a document into the Documents folder of Document Center of Sharepoint through the WSS 3.0 Web Service. For this I
am using the AddAttachment() method of the Lists object. Please refer sample code below.
Does anybody know how to add a document programmatically into Sharepoint?
//Now instantiate the WSS Web Service and add the document to the repository.
wss.listservice.Lists listService = new wss.listservice.Lists();
listService.Credentials = repository.Credentials;
listService.Url = repository.RepositoryURI;
//Add the document to the repository.
string addAttach = listService.AddAttachment("Documents", "1", document.FileName, FileContents);
But the last line always throws a SOAPException. Don't know why. Also I am not sure about the value I have to give to the second parameter (currently hardcoded as "1"). The otherparameters have correct values in them.
Any help is appreciated.