Skip to content

The Portal class is the entry point to the portal services hosted by ArcGIS Online and ArcGIS Enterprise. A Portal instance provides access to the portal's information, including its name, URL, and other metadata. You can also use it to search for the PortalItems and PortalGroups that the portal contains.

The most common workflow for a ArcGIS Maps SDK for Qt app focuses on portal items, including searching for items, retrieving item details, managing items, and displaying items as web maps, web scenes, and galleries. The use of the PortalUser and PortalGroup classes is typically secondary, as these classes are primarily used to find items associated with the a user or a group. The tasks of creating and managing users and groups is performed through the ArcGIS Online or ArcGIS Enterprise web interface or an automation script that uses the ArcGIS Python API.

Create a portal instance

Start by creating an instance of the Portal class, passing the URL of the portal and whether the user needs to log in to the portal (authenticated access) or not (anonymous access).

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
    // Define the QUrl for the ArcGIS portal.
    const QUrl qUrlPortal("https://your-portal-url.com");

    // Create a new portal using the QUrl. This creates a portal with anonymous access.
    Portal* portal = new Portal(qUrlPortal, this);

And you can create a portal instance with authenticated access like this:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
    // Define the QUrl for the ArcGIS portal.
    const QUrl qUrlPortal("https://your-portal-url.com");

    // Create boolean with the value of true.
    constexpr auto loginRequired = true;

    // Create a new portal using the QUrl and login required = true.
    // This creates a portal with authenticated access.
    Portal* portal = new Portal(qUrlPortal, loginRequired, this);

Portal properties

Portal provides components applicable to the portal as a whole via such functions as:

The Portal::portalUser() property returns the current user in the case of authenticated access. In the case of anonymous access, it returns null. The property is of type PortalUser.

Portal info

While Portal contains many properties to describe basic information about the portal, it also exposes the PortalInfo class to provide additional metadata for the portal. You can access this metadata from the Portal::portalInfo() property. The PortalInfo class exposes information about the organization, including: default basemaps and extent to use when creating new maps, the thumbnail and banner images displayed on the organization page, a variety of query strings you can use to query groups, and more.

Search for portal items and groups

The Portal class enables you to search for portal items and portal groups. You can use Portal::findItemsAsync() to find items based on various criteria, such as keywords, tags, and owner. Similarly, Portal::findGroupsAsync() allows you to find groups within the portal. Both methods take a subclass of PortalQueryParameters as a parameter.

The key to using PortalQueryParameters effectively is to understand which subclass of PortalQueryParameters to instantiate.

  • Instantiate PortalQueryParametersForGroups and pass strings for owner and title when searching for groups that have a specific owner and title. You can set properties on the instance you just created to customize it further.
  • Instantiate PortalQueryParametersForItems with the constructor that does not take any parameters. You can set properties on the instance you just created to customize it further. For example, you could call setTypes() when searching for items of any one of a collection of PortalItemTypes.
  • You can further restrict the search by calling setOwner(), setGroupId() and/or setSearchString() on a PortalQueryParametersForGroups or PortalQueryParametersForItems object.

Pass the PortalQueryParametersForGroups or PortalQueryParametersForItems instance to the Portal::findGroupsAsync() or Portal::findItemsAsync(), respectively, to execute the search.

Search for items by user

You can search for portal items by PortalUser. To find items owned by a user, call PortalUser::fetchContentAsync(). The content is made up of lists of PortalItems and PortalFolders.

You can then iterate over the collection of subfolders. For each subfolder, call PortalUser::fetchContentInFolderAsync() and pass in the subfolder name to retrieve the portal items in the folder.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
    // Get the portal user from the portal (may require an authenticated connection).
    PortalUser* portalUser = portal->portalUser();

    // Get the portal user content at the root level using the fetch content async method.
    portalUser->fetchContentAsync().then(this, [portalUser, this]()
      {
        // Get the portal folder list model from the portal user.
        PortalFolderListModel* portalFolderListModel = portalUser->folders();

        // Loop through each portal folder in the portal folder list model.
        for (const PortalFolder& portalFolder : *portalFolderListModel)
        {
            // Get the portal user content in a folder using the fetch content in folder async method.
            portalUser->fetchContentInFolderAsync(portalFolder.folderId()).then(this,[portalFolder]()
            {
                // Display the portal folder title back to the user.
                qDebug() << "Portal Folder Title: " << portalFolder.title();
            });
        }

        // Get the portal item list model from the portal user.
        PortalItemListModel* portalItemListModel = portalUser->items();

        // Loop through each portal item in the portal item list model.
        for (PortalItem* portalItem : *portalItemListModel)
        {
            // Display the portal item title and portal item type name back to the user.
            qDebug() << "Portal Item Title: " << portalItem->title() << ", Portal Item Type Name: " << portalItem->typeName();
        }
      });

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.