Group Users

A GroupUser is a record about membership of a User within a Group.

Creating GroupUsers

GroupUsers can be created via the normal create action. When using the update action, if the GroupUser record does not exist for the given user/group IDs it will be created.

List Group Users

SDK Method

GroupUser.List();

Return Object

FilesList<GroupUser>

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
group_id
int64
Group ID. If provided, will return group_users of this group.
user_id
int64
User ID. If provided, will return group_users of this user.

Additional Arguments

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("group_id", (Int64?) 1);

try
{
    var groupUserIterator = GroupUser.List(parameters);
    foreach (GroupUser groupUser in groupUserIterator.ListAutoPaging()) {
        // Operate on groupUser
    }
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Create Group User

SDK Method

GroupUser.Create();

Return Object

GroupUser

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
group_id
int64
Required
Group ID to add user to.
user_id
int64
Required
User ID to add to group.
admin
boolean
Is the user a group administrator?

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("group_id", (Int64?) 1);
parameters.Add("user_id", (Int64?) 1);

try
{
    var groupUser = await GroupUser.Create(parameters);
    // Operate on groupUser
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Update Group User

SDK Method

groupUser.Update();

Return Object

GroupUser

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
group_id
int64
Required
Group ID to add user to.
user_id
int64
Required
User ID to add to group.
admin
boolean
Is the user a group administrator?

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("group_id", (Nullable<Int64>), shorthand: true) 1);
parameters.Add("user_id", (Nullable<Int64>), shorthand: true) 1);
parameters.Add("admin", false);

try
{
    var groupUser = (await GroupUser.List())[0];
    await groupUser.Update(parameters);
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Delete Group User

SDK Method

groupUser.Delete();

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
group_id
int64
Required
Group ID from which to remove user.
user_id
int64
Required
User ID to remove from group.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("group_id", (Nullable<Int64>), shorthand: true) 1);
parameters.Add("user_id", (Nullable<Int64>), shorthand: true) 1);

try
{
    var groupUser = (await GroupUser.List())[0];
    await groupUser.Delete(parameters);
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

The GroupUser Object

Some of the methods above return a GroupUser object. The attributes of this object are listed below.

AttributeDescription
group_name
string
Group name
group_id
int64
Group ID
user_id
int64
User ID
admin
boolean
Is this user an administrator of this group?
username
string
Username of the user