<%@ WebService Language="C#" Class="UploadService.Files" %>
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Data;
using System.IO;
using System.Web.Services;
[WebService(Namespace = "Microsoft.SharePoint.Administration")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Files : System.Web.Services.WebService
{
[WebMethod]
public string UploadDocument(string fileName, byte[] fileContents, string pathFolder)
{
if (fileContents == null)
{
return "Null Attachment";
}
try
{
SPSite site = new SPSite("http://ussrm-wsf:25594/Docs/default.aspx");
SPWeb web = site.OpenWeb();
SPFolder objFolder = myWeb.GetFolder("IBM Reports");
string fileURL = fileName;
byte[] myFile = new byte[1000];
FileStream mystream = new System.IO.FileStream(strFilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
mystream.Read(myFile, 0, 1000);
mystream.Close();
SPFile file = folder.Files.Add(fileURL, fileContents, true);
return file.TimeCreated.ToLongDateString() + "::" + file.Title;
}
catch (System.Exception ex)
{
return ex.Message + "::" + ex.Source;
}
}
}
What I want to do is enter data for the column names. For example, I have a column named ColXYZ and I want it to read "cheeseburger" when I upload a document. How do I do this