Groups serve as the data for a few different ideas in Canvas. The first is that they can be a community in the canvas network. The second is that they can be organized by students in a course, for study or communication (but not grading). The third is that they can be organized by teachers or account administrators for the purpose of projects, assignments, and grading. This last kind of group is always part of a group category, which adds the restriction that a user may only be a member of one group per category.
All of these types of groups function similarly, and can be the parent context for many other types of functionality and interaction, such as collections, discussions, wikis, and shared files.
Group memberships are the objects that tie users and groups together.
get_groups_self
: Returns groups which the current user (you) belongs to
get_groups_context
: Returns the list of active groups in the given context that are visible to user.
get_group_users
: Get users which belong to a group
get_groups_self() get_groups_context(object_id, object_type = "courses") get_group_users(group_id, group_name)
object_id | id for given type |
---|---|
object_type | course or account |
group_id | which group |
group_name | Optional, a name for the group. To be used when you know the name of the group to use. This is generally of form "Group 13", and is what is exposed to you via the Canvas UI. This is noticeably more user-friendly than the group ID number. |
users in a group
## Not run: get_groups_self ## Not run: get_groups_context(27) ## Not run: get_group_users(27314)