Tag Info

New answers tagged

1

for your origional question iv answered here about getting the root web of a site: for the root web of the site collection: SPWeb spWeb = SPContext.Current.Site.RootWeb; SPList spList = spWeb.Lists.TryGetList("MyList"); if its the root web of the root site collection than roberts way is the right way to get the spsite root! SPSite URL value following ...


3

When building CAML query it is not possible to specify multiple conditions in logical And & Or operators because logical operators only takes 2 conditions. Read more here: http://buli.waw.pl/caml-query-multiple-conditions-in-and-or-clause/


0

If you're on SPD 2010, you can do this conveniently from the UI. Under List View Tools > Options > Parameters, create a new parameter, then add a filter which uses the newly created parameter. (In SPD 2013 it's similar, but getting the UI to show the List View Tools can be a bit trickier) You can do this manually too: add a ParameterBinding (the example is ...


1

For JavaScript - var query = new SP.CamlQuery(); query.set_viewXml("<Query><Where><And><Eq><FieldRef Name='column1' /><Value Type='Choice'>Bob</Value></Eq><Eq><FieldRef Name='column2' /><Value Type='Choice'>Marley</Value></Eq></And></Where></Query>");


1

There are several errors in the code you pasted. Are you trying to use SPQuery object to do the query? If that's the case, try this out: SPList myList = SPContext.Current.Web.TryGetList("MyListTitle"); SPQuery query = new SPQuery(); query.Query = @" <Where> <And> <Eq><FieldRef Name='Column1' /><Value ...


1

<Query><Where><And><Eq><FieldRef Name='column1' /><Value Type='Choice'>Bob</Value></Eq><Eq><FieldRef Name='column2' /><Value Type='Choice'>Marley</Value></Eq></And></Where></Query> Thats It. The fields you're selecting aren't specified in the Query itself, ...


1

Assuming column1 and column2 are choice columns, the query should be: <Query> <Where> <And> <Eq> <FieldRef Name='column1' /> <Value Type='Choice'>Bob</Value> </Eq> <Eq> <FieldRef Name='column2' /> <Value ...


1

To access the rootweb use var rootWeb = SPContext.Current.Site.WebApplication.Sites[0].RootWeb; If your user will not have access to this collection, you must open it up in elevated privileges: SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(SPContext.Current.Site.WebApplication.Sites[0].Id)) ...


1

Using some CAML tools pointed at a local library with versioning enabled, I was able to get back the field ows__UIVersionString of a file. It correctly shows the version is 9.0 which is reflected in the UI. <Where> <Eq> <FieldRef Name='ID' /> <Value Type='Counter'>1</Value> </Eq> ...


1

I found a way to fix it. This query is part of 4 Caml queries. I execute them one by one. My mistake was that I used the same SPQuery object. I just changed the Query property. What I didn't know was that after the first execution the SPQuery object stores some configuration data for faster querying.You can not just change the Query property and expect it ...



Top 50 recent answers are included