Method GetListItems from sharepoint webservice not working as expected - web-services

I have a Sharepoint list and I need to get its items through the exposed webservice using the GetListItems method.
It worked fine until the number of items in the list reached 2005 (I discovered the problem at 2005, it might have happened a bit earlier, maybe at 2000 if we like round numbers)
The list I use has a default view "My items" which is supposed to filter items according to me, and I need some extra filtering on a column that contains a reference to a week.
Here a re the parameters I use:
listName: {E5FDF537-0A1F-47F7-BFEE-0922B5F6ED20}
viewName: null (gives exact same result with real view id).
query: <Where><Eq><FieldRef
Name="Week" /><Value
Type="Text">2011-W12</Value></Eq></Where>
viewFields: null
rowLimit: null
queryOptions: <IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns><DateInUtc>TRUE</DateInUtc>
webId: null
The problem is that I get the items as if the filter on me was not present, and if I try do do it by myself (with <UserID Type=\"Integer\" />), I just get no items (no errors, just no items).

Related

managing unique values across a complete list in SharePoint

I am trying to populate unique values across a multiple columns in a SharePoint list. For example if we have "column A" with value "X", none of the columns should accept the value "x" in the entire list.
Is it possible?
I tried the formula using an example.
=IF([columnA]=[ColumnB],TRUE,IF([ColumnB]<>"",TRUE,FALSE))
But i felt stupid as i had no idea why i feel it is right. But it doesn't work
Any simple and better ideas will be a great help!
I think you need PreSaveAction for this requirement, when item saving, the function will execute for client side validation, then you could call rest api to validate column A value and user input value, when return false, means validation failed and item will not save.
Demo thread.
https://sharepoint.stackexchange.com/questions/255633/limit-edit-in-sharepoint-list-to-only-3-items-per-user
SharePoint rest api filter.
https://www.c-sharpcorner.com/article/sharepoint-2013-using-rest-api-selecting-filtering-sortin/

Podio API - Python filter request

Running pypodio2
I am trying to build a simple script which pulls a set of filtered items with the item filter command. It is for my own personal use to automate invoice generation.
My end game is to filter by a calculated date field - i.e. the field pulls a date from relationship.
However so far can't seem to get my request to filter any values at all. The is a sample of what I would expect to pull all items in the app where the quantity-kg value is 10.
c.Item.filter(14928728,attributes={'filter_by':[{"quantity-kg":10}]})
This returns all the items in the app.
I have tried a few different things but can't seem to work this out.
So first I would like to work out the correct syntax for passing simple request, and then work out how to pass a request to filter by date.
Worked it out, my original code had some mistakes.
'filters' not 'filter_by'
No need to pass a list as the attributes values
Filter values need to be in 'from' 'to' from.
So the code is:
c.Item.filter(14928728,attributes={'limit':500,'filters':{'121293716':{'from':'2‌​016-08-09','to':'2016-08-09'}}})
for the dates, or
c.Item.filter(14928728,attributes={'limit':500,'filters':{'quantity-kg':{'from':‌​10,'to':20}}})
for the value field.

Sitecore Multilist with search returns nothing on the second page

I am having problem with a "Multilist with search" field. This is a Sitecore 8 instance. the field is using a query like this to fetch a list from a lucene search index named "agents_master_index" :
TemplateFilter={3EA2CB30-0D04-4D73-9282-0103D8F34074} & StartSearchLocation={95A07C68-36B6-4D0D-AAE3-A2BFBF40C2C6}&SortField=Agent Name
I have multiple issues:
1) When I open an Item based on this template, it is very slow but it ultimately returns some results on first page of the list, however the pagination and go-to-item buttons are not working and the field is not showing number of pages.
2) If I try template's standard values' item, the above problem doesn't happen but if I click on "next page" button, it returns nothing.
I looked into Search log file to see what's going on. Turns out on when it successfully returns the first page results, it is executing following query:
4832 12:32:34 INFO ExecuteQueryAgainstLucene (agents_master_index): +_datasource:sitecore +(+(+_path:11111111111111111111111111111111 +_latestversion:1) +(+_path:95a07c6836b64d0daae3a2bfbf40c2c6 +_template:3ea2cb300d044d7392820103d8f34074)) - Filter :
but to return the second page of results, the multilist runs this query:
http://localhost/sitecore/shell/Applications/Buckets/Services/Search.ashx?fromBucketListField=*&sort=Agent%20Name&template={3EA2CB30-0D04-4D73-9282-0103D8F34074}&location=95a07c6836b64d0daae3a2bfbf40c2c6&pageSize=10&pageNumber=2&sc_content=master
An returns this JSON-like result which is basically empty:
({"CurrentPage":1,"Location":"current item","PageNumbers":0,"SearchCount":"0","SearchTime":"04.3539","facets":null,"items":[],"launchType":"contenteditor:launchtab","ContextData":[],"ContextDataView":[]})
and in the search log file what is actually being executed is this:
4832 12:28:05 INFO Search Query : +(_content:* _name:* _displayname:*) +_template:3ea2cb300d044d7392820103d8f34074 +_path:95a07c6836b64d0daae3a2bfbf40c2c6
4832 12:28:05 INFO Search Index : sitecore_index
4832 12:28:05 INFO Search Took : 4346ms
I don't understand why to retrieve the second page its looking into sitecore_index instead of "agents_master_index". What is wrong here? Should i fix my query? How can I force it to pick the correct lucene index (if this is the reason behind all this confusing problem?
Any help or insight is greatly appreciated.
Edit
By the way, the StartSearchLocation is referring to an items bucket. The "agents_master_index" is referring to same location in its definition.
UPDATE
OK, so far I have managed to work around the second problem. After exchanging some comments with Richard, I concluded that (at least in Sitecore 8) content editor expects to find items which we want to search in multilist component in the same index which "Root" item exists ( {11111111-1111-1111-1111-111111111111} ) so I just added same crawler we had in "agents_master_index" to the "sitecore_index" and it worked!
However, this is still working only on template's standard values item. So the first problem has not been solved yet. In other words, the multilist doesn't work when clicking on second page or do any search on the items which have been created based on that template, it only works properly on the template itself (the standard values item)
I came across this Fix for Sitecore Multilist and TreeList with Search Bug which looks very similar to my problem, I tried it but it didn't worked for me :(

Reading Sharepoint List Calculated field from PowerShell

I am trying to pull data from a SharePoint list. The field is a calculated column that takes a yes or no answer and changes the words to archived and non-archived.
I can see the data being formatted correctly in the calculated column in IE but when I try to pull the data it shows up as nothing when I check the variable data.
$site = get-spsite https://extranet./sites/site
$web = get-spweb -Identity https://extranet/sites/site
$list=$web.getlist("https://extranet/sites/site/lists/List");
$View = $list.Views["LISTVIEW"]
$listitems = $list.Getitems($view)
foreach ($listitem in $listitems) {
I have tried this also but get an indexing a null variable error.
$mailboxdb = $listitem.Fields["mailboxdb"] -as [Microsoft.SharePoint.SPFieldCalculated];
$mailboxdb.GetFieldValueAsText($listitem["mailboxdb"]);
I see this also in the $listitems output. ows_MailboxDb='string;#Archived'
But when I check $mailboxdb its empty.
Found this but I don't know what it means by stored results.
In Powershell, although you can reference any field in the list in your script, you can only compare retrieve values from "static" fields - that is, you cannot use calculation fields. PowerShell will not complain - but you will not get results in your script. This is because the .Net library for Sharepoint will not do the field calculation for you - that only happens inside the Sharepoint UI itself.
If you need to have access to a "calculated" field, you actually need to have two fields - the calculated field (usually hidden) and a "stored result" field, which must be updated from the calculated value in the last step of the "Update" workflow. Then you can use the "stored value" field in PowerShell - and also, incidentally, in View calculations in Sharepoint.
You basically have two options here. You can have Powershell do the calculation for you, which is probably the simpler of the two options given the basic nature of your calculation.
The second option, as mentioned at the end of your post is to create a new field which can store the result of the calculation. In your case, you could call it status. Then you would create a workflow that runs whenever a list item is updated or created that stores the results of the calculated field in the results field. This seems redundant to me if you have this field for no other reason than to use the value of the calculated field in a PowerShell script.

Filter external list fields from client

BACKGROUND:
We’re developing a custom application which access SharePoint through the Client Object Model and this application need to access ECT (external content type) lists defined in SharePoint using the OM (Object Model). This application is a product that should be usable with most SharePoint installations and configuration and cannot have prior knowledge of External Lists.
When there are no filters set up for the ECT, SharePoint returns all the available items in the list (given the number is below the threshold). The moment we define a filter for this ECT, SharePoint return only the items after this filter is applied (probably correct behaviour from SP).
PROBLEM:
We need to be able to search this ECT list (non-filtered) based on text entered by a user in a search box. At the moment there seem to be no way to change the filter SharePoint applied when returning the values to the calling object.
I.e. I have 10 items in my ECT list (1,2,3…10). Each Item has 3 columns (ID, Name, Description). After setting up a filter for the ECT list, SharePoint return items 2, 3 & 6 when I ask SharePoint for a list of items.
No the user does a search the matches the description of item 7. How can I search/filter the list to return the item that match my search query?
I’ve been running in circles trying to solve this, but nothing seem to work. I tried setting the CAML query as well as the LoadQuery as defined in both http://pholpar.wordpress.com/2011/02/09/how-to-query-external-lists-on-the-client-side-using-caml/ and http://msdn.microsoft.com/en-us/library/ff464384.aspx but nothing seem to work.
Even I had this problem. Let me tell you there is no way of doing this.
Even in Server object model, there was an option to change the filters of the default view but then the SPList will return 0 items once the filter is applied.
The funny part is once your code runs & you open the list in SP UI, you can see the actual modified list. But the same cannot be queries in the object model.
Looks strange. I guess if you modify the SPList (ECT based) in this instance, then you can only get results in the next instance (like in next page refresh.....)