1) I created the below windows form and .NET Managed client object code. It is supposed to retrieve items from a “Projects” list based on my CAML query and render the returned items into a listbox. It works fine but everything gets returned. The filter is not really working. Any ideas?
Here’s my form:
using (ClientContext ctx = new ClientContext("http://isaac.issharepoint.com/examples/"))
ctx.Credentials = new NetworkCredential("guest1", "xxxxxx#", "Sharepointroad");
Site site = ctx.Site; //Loads site collection into the site object
Web wb = site.RootWeb;
ctx.ExecuteQuery(); //Go to the server and run all that has been loaded
List lst = wb.Lists.GetByTitle("Projects");
CamlQuery query = new CamlQuery();
query.ViewXml = "<Query><Where><Eq><FieldRef Name='ProjNumber' /><Value Type='Text'>"+proj.Text.ToString()+"</Value></Eq></Where></Query>";
ListItemCollection all = lst.GetItems(query);
foreach (ListItem myList in all)
listBox1.Items.Add("Project Number: " + myList["ProjNumber"]);
listBox1.Items.Add(" Amount Projected: " + myList["AmtProjected"]);
listBox1.Items.Add(" Fiscal Year: "+myList["FiscalYear"]);
2) How do I change “Web wb = site.RootWeb;” to really point to http://isaac.issharepoint.com/examples/
I don’t want the root level “Projects” list. I want the “Projects” in the “examples” site. Yesterday, I kept getting an error and it went away when I created a “Projects” list at site collection level which is not the list I want.
Any ideas? Thanks for any help you can provide.