A group is a collection of items in a portal.
Working with groupsGroups are used to organize and share items and define which users can access and view the content. You can create groups of hosted layers, web maps, or any other item type. Or you can create a group and add users to it, allowing them to collaborate and share items within the group.
The typical workflow for using groups is to:
Define a group in a portal. Add items the group. Add users to the group. Manage the group properties. Examples Search for a groupFind a one or more groups in a portal using a query.
Copy
import { searchGroups } from "@esri/arcgis-rest-portal";
// Find groups with text
searchGroups( 'water' )
. then (response) // response.total => 355
Create a new groupDefine a new group and how it can be accessed.
Copy
import { createGroup } from "@esri/arcgis-rest-portal";
// Create a new public group
createGroup({
group : {
title: "Traffic issues",
access : "public"
},
authentication
})
. then (response)
Invite users to a groupInvite users by their user names.
Copy
const authentication: IAuthenticationManager; // Typically passed into to the function
// Send invitations
const options: IInviteGroupUsersOptions = {
id: 'group_id' ,
users: [ 'ed' , 'edd' , 'eddy' ],
role: 'group-member' ,
expiration: 20160 ,
authentication
}
// Wait for results
const result = await inviteGroupUsers(options);
// Accepted
const if_success_result_looks_like = {
success: true
}
// Declined
const if_failure_result_looks_like = {
success: false ,
errors: [ArcGISRequestError]
}
Add items to a groupAdd an item to group to be shared with a set of users.
Copy
import { shareItemWithGroup } from '@esri/arcgis-rest-portal' ;
// Add an item to a group
shareItemWithGroup({
id: "abc123",
groupId: "xyz987",
owner : "some-owner",
authentication
})
Search for group contentFind items shared with a group using a query.
Copy
import { searchGroupContent } from "@esri/arcgis-rest-portal";
// Find items that match in group
searchGroupContent( 'water' )
. then (response) // response.total => 355
Update propertiesChange the properties of a group such as the name, description, and permissions.
Copy
import { updateGroup } from '@esri/arcgis-rest-portal' ;
// Update properties
updateGroup({
group : { id: "fgr344", title: "new" }
})
. then (response)
Tutorials