I have created a webservice that can upload files to my sharepoint site library. Here is the code I have so far:
[WebMethod]
public string getLibraries(byte[] contents, String destUrl){
String message = "1";
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb site = new SPSite(destUrl).OpenWeb();
site.AllowUnsafeUpdates = true;
message = "2";
EnsureParentFolder(site, destUrl);
site.Files.Add(destUrl, contents);
message = "3";
site.AllowUnsafeUpdates = false;
});
return message;
}
This is working at the moment. But in sharepoint you can add new columns in a library. Like if you would like to add a description of the file or something.
How do I upload those extra columns with the file?
Another thing I am trying to figure out:
Right now it uploads files under the name "System account". I have tried setting the credentials of the webservice to the credentials of the client app but it didn’t change it.
How do I change this to the login of the user who is using the webservice?
example: file uploaded by myDomain/User1
thanks
-Gen-
1 Answer