Hi
I can successfully get the items in a list, ok good.
However, when i try to restrict the data set returned, no joy, all columns are returned.
e.g see below
Even when i use the caml designer, and select 3 columns say, the "Test" function returns all columns
http://www.camldesigner.com/?p=594 when i do this works, but returns 4 extra columns "id, create, modify, FileRef"
Its caml is
<ViewFields>
<FieldRef Name='Title' />
<FieldRef Name='Start_x002f_Top_x0020__x0020_Are' />
<FieldRef Name='Location' />
</ViewFields>
>> Does anyone know what is going on or the solution ?
# $defaultview.viewfields.SchemaXml = <FieldRef Name="Title" /><FieldRef Name="Start_x002f_Top_x0020__x0020_Are" /><FieldRef Name="Location" /> $camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery $camlQuery.ViewXml = '<OrderBy><FieldRef Name="Title" Ascending="False" /></OrderBy>'`+ "<view><ViewFields>"`+ $defaultview.viewfields.SchemaXml `+ "</ViewFields></view>" $items = $list.GetItems($camlQuery) $ctx.Load($items) $ctx.ExecuteQuery() # Returned items has 48 columns in each row
NB: It seems the issue maybe the caml is being ignored, i.e. when i tell it NOT to orderby ascending, there is no change in the order of items in $items, the load and execute are working in that values are populated.
PM Update: Moving "<view>" to the top level of the caml did improve things, this time only 10 extra items.
The order was ignored so there must be something very specific the system is expecting or a bug.
This stuff is like fishing, ya don't know what you will catch..