Public Shared Function GetPortalInfoAsync( _ ByVal portal As ArcGISPortal _ ) As Task(Of PortalInfo)
public static Task<PortalInfo> GetPortalInfoAsync( ArcGISPortal portal )
Parameters
- portal
Public Shared Function GetPortalInfoAsync( _ ByVal portal As ArcGISPortal _ ) As Task(Of PortalInfo)
public static Task<PortalInfo> GetPortalInfoAsync( ArcGISPortal portal )
| Exception | Description |
|---|---|
| PortalConnectionDoesNotExistsException | Thrown when an invalid portal is provided as the active portal. |
| System.Net.Http.HttpRequestException | You do not have permissions to access this resource or perform this operation. |
| System.Net.Http.HttpRequestException | Request failed: status code {status code}. |
{
//If no-one is signed in, this will be the default view for
//the anonymous user.
var online = ArcGISPortalManager.Current.GetPortal(new Uri("http://www.arcgis.com"));
var portalInfo = await online.GetPortalInfoAsync();
}
{
var myPortal = ArcGISPortalManager.Current.GetPortal(new Uri("https://machine.domain.com/portal/"));
var portalInfo = await myPortal.GetPortalInfoAsync();
var orgid = portalInfo.OrganizationId;
}
{
var owner = portal.GetSignOnUsername();
var portalInfo = await portal.GetPortalInfoAsync();
//1. Get all web maps
var query1 = PortalQueryParameters.CreateForItemsOfType(PortalItemType.WebMap);
//2. Get all web maps and map services - include user, organization
// and "usa" in the title
var query2 = PortalQueryParameters.CreateForItemsOfTypes(new List<PortalItemType>() {
PortalItemType.WebMap, PortalItemType.MapService}, owner, "", "title:usa");
query2.OrganizationId = portalInfo.OrganizationId;
//retrieve in batches of up to a 100 each time
query2.Limit = 100;
//Loop until done
var portalItems = new List<PortalItem>();
while (query2 != null)
{
//run the search
PortalQueryResultSet<PortalItem> results = await portal.SearchForContentAsync(query2);
portalItems.AddRange(results.Results);
query2 = results.NextQueryParameters;
}
//process results
foreach (var pi in portalItems)
{
//Do something with the portal items
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)