Skip to content
import Portal from "@arcgis/core/portal/Portal.js";
Inheritance:
PortalAccessor
Since
ArcGIS Maps SDK for JavaScript 4.0

The Portal class is part of the ArcGIS Enterprise portal that provides a way to build applications that work with content from ArcGIS Online or an ArcGIS Enterprise portal. ArcGIS Enterprise is software from Esri that customers can deploy either on-premises or in the cloud. ArcGIS Online is Esri's Software as a Service offering that represents GIS as a Service and is implemented using the same technology as ArcGIS Enterprise.

The Portal API allows application developers to work with users, groups and content hosted within ArcGIS Online or within an ArcGIS Enterprise portal. The API allows developers to build web, mobile, and desktop applications that support sharing and collaboration using web maps. Organizational developers can also use the API to build custom applications for their users.

The Portal class provides a view of the portal as seen by the current user, anonymous or logged in. It includes information such as the name, logo, featured items and supported protocols (http vs https) for this portal. If the user is not logged in, this call will return the default view of the portal. If the user is logged in, the view of the portal returned will be specific to the organization that the user belongs to. The default view of the portal is dependent on the culture of the user that is obtained from the users profile.

If no url is set before loading the Portal, the API defaults to that of esriConfig.portalUrl. There may be scenarios when more than one portal instance are needed. In these circumstances, there are a couple of different options to take into account.

  1. Set a new Portal instance within the PortalItem and set the portal's url.
    Layer.fromPortalItem({
    portalItem: {
    id: "e691172598f04ea8881cd2a4adaa45ba",
    // autocastable to Portal
    portal: {
    url: "https://thePortalUrl"
    }
    }
    });
  2. Create separate portal instances before passing them into the PortalItem's portal property.
    let portalA = new Portal({
    url: "https://www.exampleA.com/arcgis" // First instance
    });
    let portalB = new Portal({
    url: "https://www.exampleB.com/arcgis" // Second instance
    });
    let item = new PortalItem({
    id: "e691172598f04ea8881cd2a4adaa45ba",
    portal: portalA // This loads the first portal instance set above
    });
    item.load();

The when() method on the Portal instance can be called to execute processes that may only run after the Portal is loaded.

// load the Portal and PortalQueryParams modules
const [Portal, PortalQueryParams] = await $arcgis.import([
"@arcgis/core/portal/Portal.js",
"@arcgis/core/portal/PortalQueryParams.js"
]);
portal = new Portal();
// Setting authMode to immediate signs the user in once loaded
portal.authMode = "immediate";
// Once portal is loaded, user signed in
portal.load().then(function() {
console.log(portal);
// Create query parameters for the portal search
// This object autocasts as new PortalQueryParams()
let queryParams = {
query: "owner:" + portal.user.username,
sortField: "numViews",
sortOrder: "desc",
num: 20
};
// Query the items based on the queryParams created from portal above
portal.queryItems(queryParams).then(createGallery);
});
See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
"public" | "private" | null | undefined
declaredClass
readonly inherited
id
isOrganization
readonly
loaded
readonly
loadError
readonly inherited
loadStatus
readonly inherited
"not-loaded" | "loading" | "failed" | "loaded"
loadWarnings
readonly inherited
any[]
"multitenant" | "singletenant" | null | undefined
any
restUrl
readonly
any
thumbnailUrl
readonly
"english" | "metric" | null | undefined
url

access

Property
Type
"public" | "private" | null | undefined

The access level of the organization. When public, anonymous users can access the organization. When private, access is restricted to only members of the organization.

allSSL

Property
Type
boolean

When true, access to the organization's Portal resources must occur over SSL.

Default value
false

authMode

Property
Type
PortalAuthMode

The authentication mode for handling authentication when the user attempts to access a secure resource.

Possible ValueDescription
anonymousAn error will be returned when a secure resource is requested.
autoThe user will be signed in when a secure resource is requested.
immediateThe user will be signed in when the Portal is loaded.
no-promptChecks for whether the user is already signed in. If so, no additional prompts display for sign-in.
Default value
"auto"

authorizedCrossOriginDomains

Property
Type
string[] | null | undefined

Array of trusted servers to send credentials to when making Cross-Origin Resource Sharing (CORS) requests to access services secured with web-tier authentication.

basemapGalleryGroupQuery

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.4

The query that defines the basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is not true. The fetchBasemaps() method does this automatically.

basemapGalleryGroupQuery3D

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.27

The query that defines the 3D basemaps that should be displayed in the BasemapGallery. The fetchBasemaps() method does this automatically.

bingKey

Property
Type
string | null | undefined

The Bing key to use for web maps using Bing Maps.

canListApps

Property
Type
boolean

Indicates whether an organization can list applications in the marketplace.

Default value
false

canListData

Property
Type
boolean

Indicates whether an organization can list data services in the marketplace.

Default value
false

canListPreProvisionedItems

Property
Type
boolean

Indicates whether an organization can list pre-provisioned items in the marketplace.

Default value
false

canProvisionDirectPurchase

Property
Type
boolean

Indicates whether an organization can provision direct purchases in the marketplace without customer request.

Default value
false

canSearchPublic

Property
Type
boolean

When true, the organization's public items, groups and users are included in search queries. When false, no public items outside of the organization are included. However, public items which are part of the organization are included.

Default value
true

canShareBingPublic

Property
Type
boolean

The Bing key can be shared to the public and is returned as part of a portal's description call (/sharing/rest/portals/<orgid>). This requires the access of the portal to be set to public. The canShareBingPublic property is not returned publicly but only shown to users within the organization.

Default value
false

canSharePublic

Property
Type
boolean

When true, members of the organization can share resources outside the organization.

Default value
false

canSignInArcGIS

Property
Type
boolean

Indicates whether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in.

Default value
false

canSignInIDP

Property
Type
boolean

Indicates whether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in.

Default value
false

colorSetsGroupQuery

Property
Type
string | null | undefined

The query that identifies the group containing the color sets used for rendering in the map viewer.

commentsEnabled

Property
Type
boolean

Indicates whether to allow the organization to disable commenting. When commentsEnabled is false, comments are hidden and not removed. numComments are set to zero for all items in the organization. Calls to add a comment and view comments will fail. If the organization re-enables comments, the comments display and numComments are restored.

Default value
false

created

autocast Property
Type
Date | null | undefined

Date the organization was created.

culture

Property
Type
string | null | undefined

The default locale (language and country) information.

customBaseUrl

Property
Type
string | null | undefined

The custom base URL for the portal.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

default3DBasemapQuery

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.31

The query that defines the default 3d basemap to use in scene views for the portal. The fetchDefault3DBasemap() method uses this to return a basemap object.

defaultBasemap

Property
Type
Basemap | null | undefined

The default basemap to use for the portal. Used in the map viewer.

defaultDevBasemap

Property
Type
Basemap | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.22

The default developer basemap to use for the portal when an Config is defined.

defaultExtent

autocast Property
Type
Extent | null | undefined

The default extent to use for the portal. Used in the map viewer. The extent will be in the default basemap's spatial reference.

defaultVectorBasemap

Property
Type
Basemap | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.4

The default vector basemap to use for the portal. Used in the map viewer.

description

Property
Type
string | null | undefined

A description of the organization/portal.

devBasemapGalleryGroupQuery

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.22

The query that defines the basemaps that should be displayed in the BasemapGallery when an Config is defined. The fetchBasemaps() method does this automatically.

eueiEnabled

Property
Type
boolean | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.7

Boolean value indicating whether to opt-in to the Esri User Experience Improvement (EUEI) program.

featuredGroups

Property
Type
Array<FeaturedGroup> | null | undefined

The featured groups for the portal. Returns an array of objects that provide access to the owner and title for each featured group. Each item in this array has the following specification:

featuredItemsGroupQuery

Property
Type
string | null | undefined

The query that defines the featured group. If null, then the most viewed items in the organization will be the featured items.

g3dTilesEnabled

Property
Type
boolean | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.34

Indicates whether Google 3D Tiles basemaps are enabled on this portal

g3DTilesGalleryGroupQuery

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.34

The query defining Google 3D Tiles basemaps displayed in the BasemapGallery. The fetchBasemaps() method does this automatically.

galleryTemplatesGroupQuery

Property
Type
string | null | undefined

The query that identifies the group containing features items for the gallery. Set a Group ID or, if null, then the most viewed items in your organization are displayed in the gallery.

hasCategorySchema

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.8

Indicates whether the organization has content categories.

Default value
false

hasClassificationSchema

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.31

Indicates whether the organization has classification schema.

Default value
false

helperServices

Property
Type
any | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.4

This class contains properties to obtain information for various web services available on the portal. This is useful for determining the URLs for relevant methods from the portal.helperServices object. The url property of each helper service is the URL to the REST endpoint for that service.

It is recommended to use these URLs with their respective rest modules instead of the deprecated helper methods. For additional information about helper services, see the about utility services topic from the ArcGIS Server documentation.

Example
// create new Portal object with relevant URL
const portal = new Portal({
url: "YOUR_PORTAL_URL"
});
// load Portal instance
portal.load().then(function() {
// display all helper services
console.log("Show available helperServices: ", portal.helperServices);
// access helperServices from the Portal instance
// to get the routing URL of interest
const routeURL = portal.helperServices.route.url;
// use helperServices to perform routing
route.solve(routeURL, routeParams).then(showRouteInfo);
}

homePageFeaturedContent

Property
Type
string | null | undefined

The group that contains featured content to be displayed on the home page.

homePageFeaturedContentCount

Property
Type
number | null | undefined

The number of featured items that can be displayed on the home page. The max is 100. Accepts integers only.

httpPort

Property
Type
number | null | undefined

The port used by the portal for HTTP communication.

httpsPort

Property
Type
number | null | undefined

The port used by the portal for HTTPS communication.

id

Property
Type
string | null | undefined

The id of the organization that owns this portal. If null then this is the default portal for anonymous and non-organizational users.

ipCntryCode

Property
Type
string | null | undefined

The country code of the calling IP (ArcGIS Online only).

isOrganization

readonly Property
Type
boolean

Indicates whether the portal is an organization.

isPortal

Property
Type
boolean

Indicates if the portal is on-premises.

Default value
false

isReadOnly

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.14

Indicates if the portal is in read-only mode. When true, content cannot be created, modified, or deleted on the Portal.

Default value
false

layerTemplatesGroupQuery

Property
Type
string | null | undefined

The query that identifies the group containing editing templates.

loaded

readonly Property
Type
boolean

Indicates whether the portal's resources have loaded. When true, all the properties of the object can be accessed.

Default value
false

loadError

readonlyinherited Property
Type
EsriError | null | undefined
Inherited from: LoadableMixin

The Error object returned if an error occurred while loading.

loadStatus

readonlyinherited Property
Type
"not-loaded" | "loading" | "failed" | "loaded"
Inherited from: LoadableMixin

Represents the status of a load() operation.

ValueDescription
not-loadedThe object's resources have not loaded.
loadingThe object's resources are currently loading.
loadedThe object's resources have loaded without errors.
failedThe object's resources failed to load. See loadError for more details.
Default value
"not-loaded"

loadWarnings

readonlyinherited Property
Type
any[]
Inherited from: LoadableMixin

A list of warnings which occurred while loading.

maxTokenExpirationMinutes

Property
Type
number | null | undefined

The maximum validity in minutes of tokens issued for users of the organization. -1 is the default and is a special value that indicates infinite timeout or permanent tokens. For tokens granted using OAuth 2.0 authorization grant, it represents the maximum validity of refresh tokens. For access tokens, the maximum validity is the lower of two weeks or this value.

modified

autocast Property
Type
Date | null | undefined

Date the organization was last modified.

name

Property
Type
string | null | undefined

Name of the organization.

portalHostname

Property
Type
string | null | undefined

URL of the portal host.

portalMode

Property
Type
"multitenant" | "singletenant" | null | undefined

The portal mode.

portalProperties

Property
Type
any

Properties specific to the organization, for example the "contact us" link. If the organization is public, the properties are visible to the anonymous user.

recycleBinEnabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.30

Indicates whether the recycle bin is enabled for the organization.

Default value
false

region

Property
Type
string | null | undefined

The region for the organization.

restUrl

readonly Property
Type
string

The REST URL for the portal, for example "https://www.arcgis.com/sharing/rest" for ArcGIS Online and "https://www.example.com/arcgis/sharing/rest" for your in-house portal.

rotatorPanels

Property
Type
any[] | null | undefined

Custom HTML for the home page.

showHomePageDescription

Property
Type
boolean

Indicates whether the description of your organization displays on the home page.

Default value
false

sourceJSON

Property
Type
any
Since
ArcGIS Maps SDK for JavaScript 4.13

The JSON used to create the property values when the Portal is loaded. Although most commonly used properties are exposed on the Portal class directly, this provides access to all information returned by the portal. This property is useful if working in an application built using an older version of the API which requires access to portal properties from a more recent version.

See also

supportsHostedServices

Property
Type
boolean

Indicates whether hosted services are supported.

Default value
false

symbolSetsGroupQuery

Property
Type
string | null | undefined

The query that defines the symbols sets.

templatesGroupQuery

Property
Type
string | null | undefined

The query that defines the collection of templates that will appear in the template gallery.

thumbnailUrl

readonly Property
Type
string | null

The URL to the thumbnail of the organization.

units

Property
Type
"english" | "metric" | null | undefined

Sets the units of measure for the organization's users. The user default is derived from the organization's region.

url

Property
Type
string

The URL to the portal instance. Setting the location of the portal instance via esriConfig.portalUrl should be used in favor of setting it directly on this property.

If using an on-premise portal, the syntax should look similar to: https://www.example.com/arcgis

Default Value: The default value for this property is the same as the esriConfig.portalUrl property value.

urlKey

Property
Type
string | null | undefined

The prefix selected by the organization's administrator to be used with the customBaseURL.

use3dBasemaps

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.27

When false, 3D basemaps are hidden from the BasemapGallery, regardless of the type of the view.

Default value
true

useDefault3dBasemap

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.31

When false, The default 3d basemap is not used in the SceneViewer.

Default value
false

user

Property
Type
PortalUser | null | undefined

Information representing a registered user of the portal.

useStandardizedQuery

Property
Type
boolean

When true, only simple where clauses that are compliant with SQL92 can be used when querying layers and tables. The recommended security setting is true.

Default value
false

useVectorBasemaps

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.4

When true, the organization has opted in to use the vector tile basemaps, and (a) vectorBasemapGalleryGroupQuery should be used instead of basemapGalleryGroupQuery, while (b) defaultVectorBasemap should be used instead of defaultBasemap. The fetchBasemaps() method automatically uses vectorBasemapGalleryGroupQuery.

Default value
false

vectorBasemapGalleryGroupQuery

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.4

The query that defines the vector tiles basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is true. The fetchBasemaps() method does this automatically.

Methods

MethodSignatureClass
fromJSON
inherited static
fromJSON(json: any): any
getDefault
static
getDefault(): Portal
cancelLoad
inherited
cancelLoad(): this
createElevationLayers(): Promise<ElevationLayer[]>
fetchBasemaps(basemapGalleryGroupQuery?: string, options?: FetchBasemapsOptions | null | undefined): Promise<Basemap[]>
fetchCategorySchema(options?: AbortOptions | null | undefined): Promise<object[]>
fetchClassificationSchema(options?: AbortOptions | null | undefined): Promise<object | null | undefined>
fetchDefault3DBasemap(options?: AbortOptions): Promise<Basemap | null | undefined>
fetchFeaturedGroups(options?: AbortOptions | null | undefined): Promise<PortalGroup[]>
fetchRegions(options?: AbortOptions | null | undefined): Promise<object[]>
fetchSettings(options?: AbortOptions | null | undefined): Promise<object>
isFulfilled
inherited
isFulfilled(): boolean
isRejected
inherited
isRejected(): boolean
isResolved
inherited
isResolved(): boolean
load
inherited
load(options?: AbortOptions | null | undefined): Promise<this>
queryGroups(queryParams: PortalQueryParamsProperties, options?: AbortOptions | null | undefined): Promise<PortalQueryResult<PortalGroup>>
queryItems(queryParams: PortalQueryParamsProperties, options?: AbortOptions | null | undefined): Promise<PortalQueryResult<PortalItem>>
queryUsers(queryParams: PortalQueryParamsProperties, options?: AbortOptions | null | undefined): Promise<PortalQueryResult<PortalUser>>
toJSON
inherited
toJSON(): any
when
inherited
when<TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameters
ParameterTypeDescriptionRequired
json
any

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
any

Returns a new instance of this class.

getDefault

static Method
Signature
getDefault (): Portal

A new Portal instance is created the first time this method is called. The URL from Config is automatically used for this instance. This instance is then cached and used for any subsequent calls to this method.

Returns
Portal

The Portal instance.

cancelLoad

inherited Method
Signature
cancelLoad (): this
Inherited from: LoadableMixin

Cancels a load() operation if it is already in progress.

Returns
this

createElevationLayers

Method
Signature
createElevationLayers (): Promise<ElevationLayer[]>
Since
ArcGIS Maps SDK for JavaScript 4.12

A helper function that returns an array of ElevationsLayers derived from the Portal's Limited Error Raster Compression (LERC) elevation helper service.

See also
Returns
Promise<ElevationLayer[]>

When resolved, returns an array of ElevationLayers.

fetchBasemaps

Method
Signature
fetchBasemaps (basemapGalleryGroupQuery?: string, options?: FetchBasemapsOptions | null | undefined): Promise<Basemap[]>

Fetches the basemaps that are displayed in the BasemapGallery. When an Config is defined, the basemaps will be based on devBasemapGalleryGroupQuery. When useVectorBasemaps is true, the basemaps will be based on vectorBasemapGalleryGroupQuery. Otherwise, it is based on basemapGalleryGroupQuery.

Parameters
ParameterTypeDescriptionRequired
basemapGalleryGroupQuery

When provided, this argument is used to fetch basemaps based on input query parameters.

options

An object with the following properties.

Returns
Promise<Basemap[]>

Resolves to an array of Basemap objects representing the basemaps used in the Basemap Gallery of the Portal.

Example
portal.fetchBasemaps("title:\"Cloud Creek Basemaps\" AND owner:jsmith")
.then(function(basemaps){
// do something with the basemaps
});

fetchCategorySchema

Method
Signature
fetchCategorySchema (options?: AbortOptions | null | undefined): Promise<object[]>
Since
ArcGIS Maps SDK for JavaScript 4.8

If present, fetches the organization's category schema.

Parameters
ParameterTypeDescriptionRequired
options

An object with the following properties.

Returns
Promise<object[]>

Resolves to an array of objects containing the following properties:

PropertyTypeDescription
titlestringThe title of the category schema.
categoriesobject[]An array of objects containing a title and an array of categories.
Example
// Fetches the category schema
portal.fetchCategorySchema().then(function(schemas){
schemas.forEach(function(schema){
console.log("schema: ", schema);
});
});

fetchClassificationSchema

Method
Signature
fetchClassificationSchema (options?: AbortOptions | null | undefined): Promise<object | null | undefined>
Since
ArcGIS Maps SDK for JavaScript 4.32

If present, fetches the organization's classification schema.

See also
Parameters
ParameterTypeDescriptionRequired
options

An object.

Returns
Promise<object | null | undefined>

Resolves to an object with properties listed here.

Example
// Fetches the classification schema
portal.fetchClassificationSchema().then(function(schema){
console.log("schema: ", schema);
});

fetchDefault3DBasemap

Method
Signature
fetchDefault3DBasemap (options?: AbortOptions): Promise<Basemap | null | undefined>
Since
ArcGIS Maps SDK for JavaScript 4.31

Fetches the default 3d Basemap to use in SceneView for this portal.

Parameters
ParameterTypeDescriptionRequired
options

An object with the following properties.

Returns
Promise<Basemap | null | undefined>

Resolves to a Basemap object.

fetchFeaturedGroups

Method
Signature
fetchFeaturedGroups (options?: AbortOptions | null | undefined): Promise<PortalGroup[]>

Fetches the featured groups in the Portal.

Parameters
ParameterTypeDescriptionRequired
options

An object with the following properties.

Returns
Promise<PortalGroup[]>

Resolves to an array of PortalGroup objects.

Example
// fetch featured groups
portal.fetchFeaturedGroups().then(function(groups){
groups.forEach(function(group){
group.fetchMembers().then(function(members){
console.log("member", members);
});
});
});

fetchRegions

Method
Signature
fetchRegions (options?: AbortOptions | null | undefined): Promise<object[]>
Since
ArcGIS Maps SDK for JavaScript 4.8

Fetches and returns the associated regions with the portal instance.

See also
Parameters
ParameterTypeDescriptionRequired
options

An object with the following properties.

Returns
Promise<object[]>

Resolves to an array of objects containing the following properties:

PropertyTypeDescription
localizedNamestringThe localized name for the region. For example, "Australia".
namestringThe name of the region. For example, "Australia".
regionstringRegion name. For example, "AU".

fetchSettings

Method
Signature
fetchSettings (options?: AbortOptions | null | undefined): Promise<object>
Since
ArcGIS Maps SDK for JavaScript 4.23

Fetches and returns the portal settings as seen by the current user(s), whether anonymous or signed in. This returns information such as any accessible helper services, allowed redirect URIs, and the configuration for any access notices or information banners.

See also
Parameters
ParameterTypeDescriptionRequired
options

An object with the following properties.

Returns
Promise<object>

Resolves to an object containing information such as helper services, redirect URIs, and configurations for access notices or information banners.

isFulfilled

inherited Method
Signature
isFulfilled (): boolean
Inherited from: EsriPromiseMixin

isFulfilled() may be used to verify if creating an instance of the class is fulfilled (either resolved or rejected). If it is fulfilled, true will be returned.

Returns
boolean

Indicates whether creating an instance of the class has been fulfilled (either resolved or rejected).

isRejected

inherited Method
Signature
isRejected (): boolean
Inherited from: EsriPromiseMixin

isRejected() may be used to verify if creating an instance of the class is rejected. If it is rejected, true will be returned.

Returns
boolean

Indicates whether creating an instance of the class has been rejected.

isResolved

inherited Method
Signature
isResolved (): boolean
Inherited from: EsriPromiseMixin

isResolved() may be used to verify if creating an instance of the class is resolved. If it is resolved, true will be returned.

Returns
boolean

Indicates whether creating an instance of the class has been resolved.

load

inherited Method
Signature
load (options?: AbortOptions | null | undefined): Promise<this>
Inherited from: LoadableMixin

Loads the resources referenced by this class. This method automatically executes for a View and all of the resources it references in Map if the view is constructed with a map instance.

This method must be called by the developer when accessing a resource that will not be loaded in a View.

The load() method only triggers the loading of the resource the first time it is called. The subsequent calls return the same promise.

It's possible to provide a signal to stop being interested into a Loadable instance load status. When the signal is aborted, the instance does not stop its loading process, only cancelLoad() can abort it.

Parameters
ParameterTypeDescriptionRequired
options

Additional options.

Returns
Promise<this>

Resolves when the resources have loaded.

queryGroups

Method
Signature
queryGroups (queryParams: PortalQueryParamsProperties, options?: AbortOptions | null | undefined): Promise<PortalQueryResult<PortalGroup>>

Executes a query against the Portal to return an array of PortalGroup objects that match the input query.

See also
Parameters
ParameterTypeDescriptionRequired
queryParams

The input query parameters defined in PortalQueryParams.

options

An object with the following properties.

Returns
Promise<PortalQueryResult<PortalGroup>>

When resolved, resolves to an instance of PortalQueryResult which contains a results array of PortalGroup objects representing all the groups that match the input query.

queryItems

Method
Signature
queryItems (queryParams: PortalQueryParamsProperties, options?: AbortOptions | null | undefined): Promise<PortalQueryResult<PortalItem>>

Executes a query against the Portal to return an array of PortalItem objects that match the input query.

See also
Parameters
ParameterTypeDescriptionRequired
queryParams

The input query parameters defined in PortalQueryParams.

options

An object with the following properties.

Returns
Promise<PortalQueryResult<PortalItem>>

When resolved, resolves to an instance of PortalQueryResult which contains a results array of PortalItem objects representing all the items that match the input query.

Example
// Once portal is loaded, user signed in
portal.load().then(function() {
console.log(portal);
// Create query parameters for the portal search
// This object autocasts as new PortalQueryParams()
let queryParams = {
query: "owner:" + portal.user.username,
sortField: "numViews",
sortOrder: "desc",
num: 20
};
// Query the items based on the queryParams created from portal above
portal.queryItems(queryParams).then(createGallery);
});

queryUsers

Method
Signature
queryUsers (queryParams: PortalQueryParamsProperties, options?: AbortOptions | null | undefined): Promise<PortalQueryResult<PortalUser>>

Executes a query against the Portal to return an array of PortalUser objects that match the input query.

See also
Parameters
ParameterTypeDescriptionRequired
queryParams

The input query parameters defined in PortalQueryParams.

options

An object with the following properties.

Returns
Promise<PortalQueryResult<PortalUser>>

When resolved, resolves to an instance of PortalQueryResult which contains a results array of PortalUser objects representing all the items that match the input query.

Example
// Once portal is loaded, user signed in
portal.load().then(function() {
// queryUsers
// This object autocasts as new PortalQueryParams()
let queryParameters = {
query: "username:" + portal.user.username
};
portal.queryUsers(queryParameters).then(function(queryResults){
queryResults.results[0].fetchFolders().then(function(folders){
folders.forEach(function(folder){
console.log(" user folder", folder.title);
});
});
});
});

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
any

The ArcGIS portal JSON representation of an instance of this class.

when

inherited Method
Signature
when <TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>
Type parameters
<TResult1 = this, TResult2 = never>
Inherited from: EsriPromiseMixin
Since
ArcGIS Maps SDK for JavaScript 4.6

when() may be leveraged once an instance of the class is created. This method takes two input parameters: an onFulfilled function and an onRejected function. The onFulfilled executes when the instance of the class loads. The onRejected executes if the instance of the class fails to load.

Parameters
ParameterTypeDescriptionRequired
onFulfilled

The function to call when the promise resolves.

onRejected

The function to execute when the promise fails.

Returns
Promise<TResult1 | TResult2>

Returns a new promise for the result of onFulfilled that may be used to chain additional functions.

Example
// Although this example uses MapView, any class instance that is a promise may use when() in the same way
let view = new MapView();
view.when(function(){
// This function will execute once the promise is resolved
}, function(error){
// This function will execute if the promise is rejected due to an error
});

Type definitions

FeaturedGroup

Type definition

owner

Property
Type
string

Name of the group owner.

title

Property
Type
string

Group title.