Updating Users

For Updating the properties of an User in Itslearning the following functions can be used:

UpdateUser

This function updates the given User in Itlearning, by changing the properties that are given in the user object. Changing the SyncKey of a user has to be done with the ChangeUserKey function. When updating a User the required fields do not have to be filled in, only the SyncKey is required.

Syntax:

OperationResult warning = ImsEsClient.UpdateUser(User updatedUser);

Parameters:

updatedUser:

The user object containing the updated properties.

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 updated User is not valid (properties too long) this exception will be thrown.

UpdateUsers

This function updates all the given Users in Itlearning, by changing the properties that are given in the user object. When updating users the required fields do not have to be filled in, only the SyncKey is required.

Syntax:

BatchOperationResult warning = ImsEsClient.UpdateUsers(ICollection<User> updatedUsers);

Parameters:

updatedUsers:

The ICollection with all the user objects containing the updated properties.

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 given Users is not valid (properties too long) this exception will be thrown.

ReplaceUser

This function replaces the given User in Itlearning, by changing the properties that are given in the user object, and deleting all the properties that are not given. Changing the SyncKey of a User has to be done with the ChangeUserKey function.

Syntax:

OperationResult warning = ImsEsClient.ReplaceUser(User updatedUser);

Parameters:

updatedUser:

The user object containing the updated properties.

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 updated User is not valid (required properties not set, other properties too long) this exception will be thrown.

ReplaceUsers

This function replaces all the given Users in Itlearning, by changing the properties that are given in the user object, and deleting all the other properties.

Syntax:

BatchOperationResult warning = ImsEsClient.ReplaceUsers(ICollection<User> updatedUsers);

Parameters:

updatedUsers:

The ICollection with all the user objects containing the updated properties.

Returns:

A OperationResult 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 the updated Users is not valid (required properties not set, other properties too long) this exception will be thrown.

ChangeUserKey

This function changes the SyncKey of the given User. This is the only way to change a synckey of a user.

Syntax:

OperationResult warning = ImsEsClient.ChangeUserKey(string oldKey, string newKey);

Parameters:

oldKey:

The current SyncKey of the user.

newKey:

The new SyncKey of the user.

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.

ChangeUserKeys

This function changes the SyncKeys of the given Users. The input of this function is an array with KeyPairs, an KeyPair is an custom object with two properties: OldKey and NewKey. This is done to easily group the keys together.

Syntax:

BatchOperationResult warning = ImsEsClient.ChangeUserKeys(ICollection<KeyPair> syncKeyPairs);

Parameters:

syncKeyPairs:

An ICollection with Keypairs, to specify the old and new SyncKeys.

Returns:

A OperationResult 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.