Tag Info

New answers tagged

1

Couldn't you refactor the SPServices call into another function, that takes the "area" value, "topic" value, and the list selector as parameters? You'd still be querying the list 24 times, but it will look a lot cleaner. $(document).ready(function () { QueryNewsList("highlights", "company", "#highlights1"); QueryNewsList("downfalls", "company", ...


1

Are you using a field whose name exceeds 32 characters? There are problems with these fields names in SharePoint 2010 only when used in ViewFields clause.


2

It's been a while since I've looked at this but I think you need to indicate the Field can be null or empty <ViewFields> <FieldRef Name='Field1' /> <FieldRef Name='Field2' Nullable='True' /> <FieldRef Name='Field3' Nullable='True' /> </ViewFields>


1

I haven't seen domain\username be used reliably to directly query the list. What I have done though, is use the GetUserInfo web service to get the user id, and then pass that through to my CAML in another function. Pseudo code: function getListItemsForUser(userid){ var caml = "<Where>"+ "<Eq>"+ "<FieldRef ...


0

I have recently created CAML Query designer based on my own requirements and I am giving that as an utility for free. Hope this will help SharePoint developers in better way. http://praveenbattula.blogspot.com/2015/02/download-caml-query-designer.html


2

In your CAML, you'd want to have something like this: <ViewFields> <FieldRef Name='Author' /> </ViewFields> <QueryOptions> <ExpandUserField>True</ExpandUserField> </QueryOptions> The key is the QueryOptions ExpandUserField portion. That will give you a string like: 2362;#Alton ...


0

The conclusion I've come to is that you cannot perform an IsNull query against an indexed column. Workarounds include: not indexing the column (and be careful of the view threshold...) query all items and perform the filtering in code (inefficient) change your data such that null values are replaced with a special 'dummy' value you can query against. This ...


0

There is a great tool from the BIWUG group for assistance in writing CAML when it comes to Sharepoint, their CAML Designer. It can help you craft the CAML you need for web services or object model.


0

There is an excellent tool available to help with complex CAML queries in JS especially when working with joins: https://camljs.codeplex.com/ Joining lists via CamlJs is very easy. Here's the example: var query = new CamlBuilder() .View(["Title","Country","Population"]) .LeftJoin("Country","Country").Select("People","Population") .Query() .Where() ...


0

If it's a custom code solution, then you can calculate value in your code, and use it in your CAML query.


0

One way to generate the CAML query is to start with a SharePoint list view. If you can use the view dialog to define the filter and the sort, then you can grab the corresponding CAML with SharePoint Designer. In this case, you may want to create a view on the EmployeeList. Filter by Title with "contains" and the desired string. Use the Sort section to ...


0

Here is a sample CAML Query: <Query> <Where> <Contains> <FieldRef Name='Title' /> <Value Type='Text'>1234</Value> </Contains> </Where> <OrderBy> <FieldRef Name='Title' Ascending='False' /> </OrderBy> </Query> In CAML Like may be done ...


1

Your OR and AND tags are not correct. They should wrap the two items being operated: <Query> <Where> <And> <Or> <IsNull> <FieldRef Name='PublishingStartDate' /> </IsNull> <Leq> <FieldRef Name='PublishingStartDate' /> ...


0

You are comparing Time values in a choice field so might be the issue of some date format i guess. Could you please try first getting result using CAML query builder through UI? CAML Query Builder It lets you easily build CAML queries through UI. You can trial and error with various values and once you get desired output, you can use that in your code.


0

Not sure why this is not working, but an alternative would be to apply the filtering directly in the CAML Query. First step would be to decompose the DateTime.Now into its year, month and day parts. Based on that you can generate a Start Date and an End Date and pass those in the CAML, filtering by StartDate (EventDate) and EndDate.


0

Instead of Contains you should use <Gt> (Greater than) or Lt (Less than). Contains operator works with String type. Since you are using decimal you should always use arithmetic logic operators.


3

In your case you need to find whether the item exists or not, so there is no problem with invoking the CAML for each check. Another approach is to form a dynamic query based on the number of rows to validate, for example if you want to validate 3 rows of data then form a query in with condition like <Or> <Or> <Eq> <FieldRef ...



Top 50 recent answers are included