# Admin

## ActivateUser

Activates an user and sends them an activation mail. Throws an error if the user could not be found. Does nothing if the user is already activated.

#### Syntax

```
ActivateUser( UserId )
```

#### Parameters

**UserId**\
The ID of the user to activate.\
Type: Guid

#### Return type

Void

## AddUserToGroup

Takes a GroupId and a UserId as input and adds a user to a group.

#### Syntax

```
Void AddUserToGroup(
    Guid GroupId,
    Guid UserId
)
```

#### Parameters

**GroupId**\
The ID of the group the user should get associated with.\
Type: Guid

**UserId**\
The ID which identifies the user.\
Type: Guid

#### **Return Type**

Void

## AddUserToOffice

Takes an OfficeId and a UserId as input and adds a user to an office.

#### Syntax

```
Void AddUserToOffice(
    Guid OfficeId,
    Guid UserId
)
```

#### Parameters

**OfficeId**\
The ID of the office the user should get added to.\
Type: Guid

**UserId**\
This ID which identifies the user.\
Type: Guid

#### Return Type

Void

## CreateUser

Creates and returns an user with the given information. Throws an error if an user with the same login name already exists.

#### Syntax

```
CreateUser ( OfficeId, LoginName, FirstName, LastName, NickName, Language )
```

#### Parameters

**OfficeId**\
The ID of the office to create the user for (the executing user must have access to it).\
Type: Guid

**LoginName**\
The e-mail address of the new user (must be unique).\
Type: String

**FirstName**\
The first name of the new user.\
Type: String

**LastName**\
The last name of the new user.\
Type: String

**NickName**\
The nick name or abbreviation of the new user.\
Type: String

**Language**\
The language of the new user.\
Type: Language

#### Return type

Object

## DeleteUserFromGroup

Takes a GroupId and a UserId as input and deletes a user from a group.

#### Syntax

```
Void DeleteUserFromGroup(
    Guid GroupId,
    Guid UserId
)
```

#### Parameters

**GroupId**\
The ID of the group the user should get deleted from.\
Type: Guid

**UserId**\
The ID which identifies the user.\
Type: Guid

#### Return Type

Void

## DeleteUserFromOffice

Takes an OfficeId and a UserId as input and deletes a user from an office.

#### Syntax

```
Void DeleteUserFromOffice(
    Guid OfficeId,
    Guid UserId
)
```

#### Parameters

**OfficeId**\
The ID of the office the user should get deleted from.\
Type: Guid

**UserId**\
This ID which identifies the user.\
Type: Guid

#### Return Type

Void

## **CreateUser**

Creates and returns an user with the given information. Throws an error if an user with the same login name already exists.

#### Syntax

```
CreateUser(
    Guid OfficeId,
    String LoginName,
    String FirstName,
    String LastName,
    String NickName,
    String Language
)
```

**Level**

PlatformAdministrator

#### Parameters

***OfficeId***\
The ID of the office to create the user for (the executing user must have access to it).\
Type: Guid

***LoginName***\
The mail address of the new user (must be unique).\
Type: String&#x20;

***FirstName***\
The first name of the new user.\
Type: String&#x20;

***LastName***\
The last name of the new user.\
Type: String&#x20;

***NickName***\
The nick name or abbreviation of the new user.\
Type: String&#x20;

***Language***\
The language of the new user. <br>

**Behavior:**&#x20;

Creates an user like the 'Admin Center' creates user: not activated or confirmed.&#x20;

User can only created for the specified office, however, user must be unique throughout the platform.

#### Return Type

Object

## ActivateUser

Activates an user and sends them an activation mail. Throws an error if the user could not be found. Does nothing if the user is already activated.

#### Syntax

```
CreateUser(
    Guid UserId,
)
```

**Level**

PlatformAdministrator

#### Parameters

***UserId***\
The ID of the user to activate.\
Type: Guid

**Behavior:**&#x20;

Activates an user like the 'Admin Center' activates user: sending the activation mail to change password and confirming the user.&#x20;

Only user to which the current executing user has access to can be activated.

#### Return Type

None


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tivity.one/building-an-application/execution/scripting/functions/admin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
