Setting the CanSearchPublic flag for the PortalQueryParameters doesn't seem to have an impact on the results:
var queryString = "type:(\"web map\" NOT \"web mapping application\")";
var portalQuery = new PortalQueryParameters (queryString);
portalQuery.CanSearchPublic = false;
var maps = await arcgisPortal.FindItemsAsync (portalQuery);
ToastHelpers.ShowInfo ("Web Maps", maps.TotalResultsCount.ToString (), 3);
Solved! Go to Solution.
Your right - it's a bug. Setting the `CanSearchPublic` flag to `false` should restrict a query to only an organization's items. I've submitted an issue to get this fixed in an upcoming release.
In the meantime you can workaround this by providing an organization id in the query string.
var orgQuery = $"orgid:{_portal.PortalInfo.OrganizationId}";
var portalQuery = PortalQueryParameters.CreateForItemsOfType(PortalItemType.WebMap, orgQuery);
var maps = await _portal.FindItemsAsync(portalQuery);
Debug.WriteLine($"Web Maps: {maps.TotalResultsCount}");
Your right - it's a bug. Setting the `CanSearchPublic` flag to `false` should restrict a query to only an organization's items. I've submitted an issue to get this fixed in an upcoming release.
In the meantime you can workaround this by providing an organization id in the query string.
var orgQuery = $"orgid:{_portal.PortalInfo.OrganizationId}";
var portalQuery = PortalQueryParameters.CreateForItemsOfType(PortalItemType.WebMap, orgQuery);
var maps = await _portal.FindItemsAsync(portalQuery);
Debug.WriteLine($"Web Maps: {maps.TotalResultsCount}");
Excellent, that'll work for now. Hadn't realized you could use the query text for the organization.
Thanks for the quick feedback, much appreciated.