jeudi 18 décembre 2014

Why is my list total showing as "Count= undefined"?



I'm updating a view on an existing list programmatically but I can't get the aggregation to work correctly. I'm setting it as follows (the values are pulled from an xml site definition):



if (AggregationStatus == "On")
{
view.Aggregations = "<FieldRef Name=\"" + AggViewField.Name + "\" Type=\"" + AggViewField.Type + "\"/>";
view.AggregationsStatus = AggregationStatus;
}
... more settings here ...
view.Update();


And if I look at the list with SharePoint Manager I can see the aggregation has been applied as follows:



<Aggregations Value="On">
<FieldRef Name="LinkFilename" Type="Count" />
</Aggregations>


Which looks correct to me, but on the site itself the aggregation shows as "Count= undefined". If I modify the view I can see that the Count total is set for the name column and if I now save the view without changing anything the aggregation works properly, which makes me wonder if the view.Update() isn't doing what I think it is. Do I need to update the list as well? Is there some kind of SP_voodoo required to get an aggregation to work?


Any suggestions gratefully accepted.


This is SharePoint 2013 Enterprise on premises and my solution is using VS 2012








0 commentaires:

Enregistrer un commentaire