Hey all,
I need to test a sharepoint solution my business has created. I have created a simple exe to be run on the actual sharepoint server.
I am trying to figure out how to use the Sharepoint Server OM to do my tests. At this point all I am trying to do is simply add an item to the library.
My first solution did something like this:
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();
etc...
The problem here is SPCOntext.Current.Site is always null.
My next attempt looked something like this:
SPSite site = new SPSite(url);
SPWeb web = site.OpenWeb();
SPList list = web.Lists[listName];
SPListItem item = list.AddItem();
item["Title"] = "Some Title";
item.Update();
This runs without any error, but when I check the list in question, the item I added isn't there.
Can anyone help guide me into where I am going wrong?