27
votes
Accepted
CAML Query, get item by lookup value, not by ID
Default lookup query uses the value instead of lookup Id
The typical query looks like
<Query>
<Where>
<Eq>
<FieldRef Name='RefCountry' />
...
7
votes
Accepted
7
votes
Accepted
People or Group field returning semicolon hash then Name
Use below code to get User name:
new SPFieldLookupValue(properties.ListItem["Staff Member"].ToString()).LookupValue;
For User ID:
new SPFieldLookupValue(properties.ListItem["Staff Member"].ToString(...
6
votes
Accepted
sharepoint search boolean managed property
Try isActive=1 this means it equals true. isActive:1 is a contains query.
6
votes
Accepted
CAML query filtering is not working
Query in your case is a string, which means that you are using the SPList.GetItems(String[]) overload.
That method accept a list of fields to load, not a query. You should be using one of the ...
6
votes
Accepted
Querytext: blank value for a property
Well I've found a solution, not very friendly but works, is based on this article
So basically the article says that you need to identify in the query how to include everything that has any value:
...
5
votes
Filter Hyperlink field url using SharePoint REST API
This is the limitation of REST API Filter that it cannot filter the Hyperlink fields.
So whats the workaround?
You can use CAML with REST to achieve what you want.
The CAML query will be like:
<...
4
votes
Accepted
List Query - How to get attachments link
Use SP.ListItem.attachmentFiles to retrieve the collection of attachments that are associated with the list item.
How to retrieve list items with attachments using JSOM
function getListItems(...
4
votes
Accepted
Security trimmed results for custom query on property
Use the following code:
using(SPSite site = new SPSite("http://example/site/"))
{
using (SPWeb web = site.OpenWeb())
{
SPWebCollection webCollection = web.GetSubwebsForCurrentUser();
...
4
votes
Search results webpart displaying items without search box query
I just wanted to add that you could always do it like this
Search only site collection and only doc or pdfs
{?{searchBoxQuery} (FileType=docx OR FileType=pdf) Path:{Site.URL}}
4
votes
In a search display template, is there a search property available for the actual text (k=...) in Srch.U or any of the search objects?
You can retrieve it from the DataProvider object. Which is accessible from within your display template.
ctx.DataProvider.get_currentQueryState()
This returns an object which gives you the whole ...
4
votes
Accepted
JS: If 'X' is mentioned anywhere in the LIST. Display
You should use <Contains> instead of <Eq> in your caml query:
var query = "<Query><Where><Contains><FieldRef Name='Category' /><Value Type='Text'>" + value + ...
3
votes
Accepted
How to use the Content Search Web Part to filter on a custom column property?
You'll need to make sure that your custom column is a Managed Property in your Search Schema. By default, all site columns are also created as Managed Properties, but if you created the custom column ...
3
votes
Accepted
How to add CAML query results with ListItems to a datasource of a repeater?
Try the following code:
SPListItemCollection items = spList.GetItems(spquery);
repeaterControl.DataSource = items.GetDataTable();
repeaterControl.DataBind();
3
votes
Accepted
List consult in JavaScript, which is the best
The way you are fetching items from the list is perfectly acceptable. As an alternative (not necessarily a better alternative, but more flexible), would be to use AJAX and SharePoint Web Services. One ...
3
votes
Search results webpart displaying items without search box query
Try wrapping your entire query with {? your query }.
3
votes
Accepted
How to get multiple lists on a page using context.executeQueryAsync?
Sounds like you need promises which are in many ways the JavaScript equivalent of the Task class in .NET
Using jQuery promises your getList code would look something like this.
function getList(...
3
votes
Accepted
Get List Items that contains spaces
You are missing quotes "" around the value of textbox.
Use
'<td><input type="text" id="detailsInput" name="Details" value="' + oListItem.get_item('Title') + '" size="35" required="required"...
3
votes
Query to a list doesn't work
Your code looks like Server Object Model. Based on my experience on using CAML queries, I can suggest you to get rid of <Query> tags. So update your query as below
Query = "<Where>" +
...
3
votes
Accepted
Importance of .Include in the query
I believe you already know how CSOM works in SharePoint though I am adding a little explanation. CSOM sends XML request to Client.svc and get JSON response.
So when you write something like following,...
3
votes
Accepted
Site Search results are the same no matter the query
Edit the Page that stores the search results
Edit the "Search Results" web part
Select "Change Query"
In the Query text box, look for {searchboxquery}
If you don't see that, the search box query will ...
3
votes
Get a result of a predefined query by one click?
If you do that Search query from the search center then you can use the resulting url. It will look something like:
[url for your search center]?k="search term"
2
votes
Accepted
Querying against a note field with the REST API 2013
The work-around is to use the Search REST API.
2
votes
Accepted
Rest queries in SP2010 with $top and $skip
When you request for a specific item (Example(19)) you can't use $skip or $top.
The $skip and $top parameters must be passed in as querystrings.
Remember to start at root path (/), so siteUrl must end ...
2
votes
How to know when async query's finished
Instead of calling context.executeQueryAsync for each item, just add the up to 50 items, then call context.executeQueryAsync after the last one and when the callback is called you're done.
2
votes
Accepted
change display style for link column type in content query webpart
There are a couple of options:
If it is a links list, you can use the notes field as display name
Link: "URL [Custom Columns];"
Title: "Notes;"
Description: leave empty
Template: Image on the ...
2
votes
Accepted
unable to add a search core result web part inside my enterprise wiki site collection
If you wanna display the latest items, i think you mean the Content Search Web Part. For this you need the enterprise license as it is not available to the foundation nor the standard edition.
If you ...
2
votes
Using CAML Query to Retreive from Multiple Lists
You can query based on relations in two lists, please have a look at List Joins and Projections
You can use joins to get the projected field Question Text, something like:
SPQuery query = new ...
2
votes
How to get the ID of a list item with a given GUID in Sharepoint online with REST api?
Use the UniqueId instead of GUID. Try the following end url,
.../_api/web/Lists/getByTitle('docLib')/items?$select=id,UniqueId&$top=1&$filter=UniqueId eq '2779cf8051-381f-4834-93dc-...
2
votes
Accepted
Sort content search web part in alpha order by title
So here is the answer I figured out. It is sort of an all-or-nothing way, but it seems to work. Not sure if it has downsides yet....
On the authoring side I went into the Search Schema and mapped ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
query × 332search × 73
2013 × 46
caml × 39
list × 37
sharepoint-online × 36
search-results × 34
2010 × 31
javascript × 27
sharepoint-enterprise × 24
rest × 24
sharepoint-server × 20
web-part × 15
caml-query × 15
powershell × 13
filter × 13
development × 10
enterprise-search × 10
content-search-web-part × 10
client-object-model × 9
url × 9
lookup-column × 8
content-query-web-part × 8
managed-property × 7
result-source × 7