Updating Memberships

There is not much to update in a Membership, only the role of the User in the Hierarchy can be changed. Aside from that is is also possible to set the Hierarchy as home organisation of a User.

UpdateMembership

This function changes the role of the User in a Hierarchy. If the original Membership was created with a custom identifier, this identifier should also be supplied. Otherwise the identifier is automatically generated (in the same way as for the original Membership).

Syntax:

OperationResult UpdateMembership(string userSyncKey, string hierarchySyncId, HierarchyRole role);
OperationResult UpdateMembership(string membershipId, string userSyncKey, string hierarchySyncId, HierarchyRole role);

Parameters:

userSyncKey:

The User that needs a new role.

hierarchySyncId:

The Hierarchy in which the role needs to be changed.

role:

The new role of the User in the Hierarchy.

membershipId:

The custom identifier of the original Membership.

Returns:

The OperationResult containing the warning that Itslearning has send back, or if there was none, null.

Exceptions:

  • ImsEsException: If IMS-ES encountered an error in Itslearning, this exception will be thrown.

  • ValidationException: If the generated identifier is too long (more than 255 characters) this exception will be thrown


UpdateMemberships

This function changes the role of the User in a Hierarchy, for all given memberships. If the original Membership was created with a custom identifier, this identifier should also be supplied. Otherwise the identifier is automatically generated (in the same way as for the original Membership).

Syntax:

BatchOperationResult UpdateMemberships(ICollection<MembershipPair> memberships);
BatchOperationResult UpdateMemberships(IDictionary<string, MembershipPair> memberships);

Parameters:

memberships:

Either: An ICollection of MembershipPair objects, containing the User synckey, Hierarchy syncid and the new role,
or: An dictionary with the custom identifiers as keys, and the MembershipPair objects as values.

Returns:

A BatchOperationResult with the list of warnings that Itslearning has send back (this list can be empty).

Exceptions:

  • ImsEsBatchException: If IMS-ES encountered an error in Itslearning, this exception will be thrown.

  • ValidationException: If one of the generated identifiers is too long (more than 255 characters) this exception will be thrown


SetHomeOrganisation

This function will set the given Hierarchy as the home organisation of the User. This function assumes that the User is already added to the Hierarchy, if not this might cause unpredictable behaviour. If the original Membership was created with a custom identifier, it should also be given here.

Syntax:

OperationResult SetHomeOrganisation(string userSyncKey, string hierarchySyncId);
OperationResult SetHomeOrganisation(string membershipId, string userSyncKey, string hierarchySyncId);

Parameters:

userSyncKey:

The User that will get a new home organisation.

hierarchySyncId:

The Hierarchy that will be the new home organisation.

membershipId:

The custom identifier of the original Membership.

Returns:

The OperationResult containing the warning that Itslearning has send back, or if there was none, null.

Exceptions:

  • ImsEsException: If IMS-ES encountered an error in Itslearning, this exception will be thrown.

  • ValidationException: If the generated identifier is too long (more than 255 characters) this exception will be thrown


SetHomeOrganisations

This function will set the given Hierarchies as the home organisation of the Users. This function assumes that the Users are already added to the Hierarchies, if not this might cause unpredictable behaviour. Therefore also if the original Membership was created with a custom identifier, this identifier should also be specified in this function. In the MembershipPairs the role doesn't have to be filled in, it will not be used.

Syntax:

BatchOperationResult SetHomeOrganisations(ICollection<MembershipPair> memberships);
BatchOperationResult SetHomeOrganisations(IDictionary<string, MembershipPair> memberships);

Parameters:

memberships:

Either: An ICollection of MembershipPair objects, containing the User synckey and Hierarchy syncid,
or: An dictionary with the custom identifiers as keys, and the MembershipPair objects as values.
(the role shouldn't be filled in.)

Returns:

A BatchOperationResult with the warnings that Itslearning has send back (this list can be empty).

Exceptions:

  • ImsEsBatchException: If IMS-ES encountered an error in Itslearning, this exception will be thrown.

  • ValidationException: If one of the generated identifiers is too long (more than 255 characters) this exception will be thrown