This is an urgent request for help as I am trying to release my addin in the next week.
I am absolutely pulling my hair out with the seemingly random results and duplicate entities from from AGOL (ArcGIS Online).
I have 1700 layer files published in our ArcGIS Online account. There are no duplicates of our layer files when I look in AGOL. I query for them using the following code:
var query = PortalQueryParameters.CreateForItemsOfTypes(new List<PortalItemType>() { PortalItemType.Layer }, "", PortalUtils.GroupID, "");
var portalItems = new List<PortalItem>();
while (query != null)
{
//run the search
PortalQueryResultSet<PortalItem> results = await portal.SearchForContentAsync(query);
portalItems.AddRange(results.Results);
query = results.NextQueryParameters;
}
foreach (var pi in portalItems)
{
//Do something with the portal items
System.Diagnostics.Debug.WriteLine($"{pi.Id}, {pi.Name}");
}When I look at the debug output above - I get 1700 results back, which on the face of it seems correct, but when I look closely at the results (I have code to look for dupes) there appears to be some objects that have duplicate item ID's and of course names. Not only this - it's NOT THE SAME DUPLICATES EVERY TIME I QUERY! They are different in the number of duplicates and the actual layers that are duplicated.
I have also manually looked at the names and sorted the results in Excel - so I know for sure duplicates are occurring - if nothing else it appears in my UI ultimately - hence why I am trying to debug and get to the bottom of this problem.
I am at a loss as to what to do here. I cannot understand it at all and it's making me pretty nervous. If you can help I would really appreciate it.