1
votes

We decided to have some User Groups completely under programmatic control. Which parameters to use when creating a Group Category, so that:

  • neither number of groups nor number of students is known in advance
  • no automatic group creation
  • auto enrollment not allowed
  • self enrollment not allowed

?

1

1 Answers

0
votes

You should be able to accomplish this with these steps (I am assuming your back-end service supports the LP API contracts of at least version 1.3 and forward):

  1. Create a group category for the groups you want to build in the future like this. In the GroupCategoryData structure you provide to this call, you can use these property settings:

    • Set EnrollmentStyle to 0 or NumerOfGroupsNoEnrollment (sic: note the mis-spelling).

    • Set EnrollmentQuantity to null

    • Set AutoEnroll and RandomizeEnrollments to false

    • Set MaxUsersPerGroup to null

    • Set NumberOfGroups to the number of groups you want to create off the start within this group category: you can create 1 and then delete it after the group category creation.

    You should get back a GroupCategoryData fetch-form structure that contains an array of any initial Group org unit IDs created within this group category, and containing the GroupCategoryId for this new category.

  2. When you want to create a group for the category, provide the group category ID from the previous step in the POST route to create the group.

  3. To enroll users into these groups, you can use the standard create-enrollment call and provide the standard EnrollmentData structure. You'll need to provide the org unit ID for the group, the user ID for the user to enroll, and the role ID for the role you want the user to have in the group. You should also set IsCascading to false here.

Note that, if your back-end service only has v1.2 of the LP API or older, then these instructions will vary slightly (read the enrollment topic in the API reference carefully).