Search...
listGroups( )
Lists groups.
Description
The listGroups()
function returns a Promise that resolves to a list of up to 1,000 groups on your site. Sorts by default to _createdDate
in descending order.
Notes:
- For
SECRET
groups, only site admins, group admins, and group members can see a list of group and their content. - This function's parameters are positional, and must be specified in the sequence shown in the syntax below. When specifying a parameter, use
null
as a placeholder for any unspecified parameters. For example, to specify limit only, calllistGroups(paging, null)
.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function listGroups(options: ListGroupsOptions): Promise<ListGroupsResponse>
listGroups Parameters
NAME
TYPE
DESCRIPTION
options
Optional
ListGroupsOptions
Limit and offset options.
Returns
Return Type:
Promise<
ListGroupsResponse
>NAME
TYPE
DESCRIPTION
groups
Array<
Group
>Retrieved Groups.
metadata
PagingMetadata
Was this helpful?
listGroups example
Copy Code
1import { groups } from 'wix-groups.v2';23 async function listGroups(options) {4 try {5 const result = await groups.listGroups(options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13