How can I get the maps from a group.

1293
5
Jump to solution
02-16-2020 03:08 AM
PHerk
by
New Contributor II

This is a working example that gets the Content in "My Content" on the online ArcGIS portal.

Access ArcGIS Online items using OAuthentication - 4.13

I am trying to change this example to get the Contents of a Group in "My Groups".

Is there a code example available, or can you give me a clear explanation how to achieve this?

I'm new to ArcGIS so not experienced at all.

Highly appreciated.

0 Kudos
1 Solution

Accepted Solutions
LeoLiu1
Occasional Contributor

Hi Piet,

Try PortalGroup class, with method queryItems

PortalGroup | API Reference | ArcGIS API for JavaScript 3.31 

Here is reference for query parameters, type should be 'map'.

Search reference—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers 

View solution in original post

5 Replies
LeoLiu1
Occasional Contributor

Hi Piet,

Try PortalGroup class, with method queryItems

PortalGroup | API Reference | ArcGIS API for JavaScript 3.31 

Here is reference for query parameters, type should be 'map'.

Search reference—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers 

PHerk
by
New Contributor II

Thank you, it worked out.

Appreciated.

0 Kudos
PHerk
by
New Contributor II

Hi Leo,

I am struggling with the query parameters.

This works:

var queryParams = new PortalQueryParams({
query: 'group:' + selectedID,
});

This works:

var queryParams = new PortalQueryParams({
query: 'type:Map,
});

This gives no result:

var queryParams = new PortalQueryParams({
query: 'group:' + selectedID + 'AND type:Map',
});

seems you can't add 2 items in the search query.

Any idea how I can have the 2 items in 1 query?

0 Kudos
LeoLiu1
Occasional Contributor

Hi Piet,

Is it because you need a space before AND operator in your query string?

var queryParams = new PortalQueryParams({
   query: 'group:' + selectedID + ' AND type:Map',
});‍‍‍
0 Kudos
PHerk
by
New Contributor II

Yes, simple mistake. I am not used working with ":" in queries and was focussing on that. Thank you very much for your help. I have the correct maps from the group.

0 Kudos