Search Results for

    Show / Hide Table of Contents

    Add new users to the workspace

    This article covers the process of adding a new user to a subscription, retrieving the list of users, and removing a user from it.

    Getting started

    You will need the following tools and facilities:

    1. Know how to use API key in FastReport Corporate Server.

      This article will skip over additional information on authentication and authorization.

    2. .NET SDK.

    3. C# code editor or text editor, e.g., Visual Studio Code.

    4. Active FastReport Corporate Server subscription that has at least two user slots.

    5. Internet access.

    Important! These guides assume that you already know how to develop your application in the C# programming language.

    Note. The items above describe recommended tools.

    Annotation

    Important! It is only possible to add a user to a workspace by user ID.

    Instruction

    1. To add a new user to a workspace, a workspace (subscription) ID is required.

      To retrieve the workspace ID, use the following method GetSubscriptionsAsync(Nullable<Int32>, Nullable<Int32>, System.Threading.CancellationToken).

      public async Task<string> GetSubscriptionId(HttpClient httpClient)
      {
          ISubscriptionsClient subscriptionsClient = new SubscriptionsClient(httpClient);
       	SubscriptionsVM subscriptions = 
              await subscriptionsClient.GetSubscriptionsAsync(0, 10);
       	SubscriptionVM subscription = subscriptions.Subscriptions.First();
          return subscription.Id;
      }
      

      In this example, the function requests the first 10 workspaces (subscriptions) from the user's list of workspaces, selects the first workspace, and returns its ID.

      A workspace always is associated with the one subscription, so they have the same ID.

    2. To add a new user, use the following method AddUserAsync(String, String, System.Threading.CancellationToken).

      public async Task AddUser(HttpClient httpClient, string subscriptionId, string userId)
      {
          ISubscriptionUsersClient subscriptionUsersClient = 
              new SubscriptionUsersClient(httpClient);
          await subscriptionUsersClient.AddUserAsync(subscriptionId, userId);
      }
      

      In this example, the function adds the user with the userId ID to the workspace with the subscriptionId ID.

    3. To retrieve the list of workspace users, use the following method GetUsersAsync(String, Nullable<Int32>, Nullable<Int32>, System.Threading.CancellationToken).

      public async Task<IEnumerable<string>> GetUsers(HttpClient httpClient, string subscriptionId)
      {
          ISubscriptionUsersClient subscriptionUsersClient = 
              new SubscriptionUsersClient(httpClient);
       	SubscriptionUsersVM users = 
              await subscriptionUsersClient.GetUsersAsync(subscriptionId, 0, 10);
       	return users.Users.Select(m => m.UserId);
      }
      

      In this example, the function requests the first 10 users from a workspace with the subscriptionId ID.

    4. To remove a user from the workspace, use the following method RemoveUserAsync(String, String, System.Threading.CancellationToken).

      public async Task RemoveUser(HttpClient httpClient, string subscriptionId, string userId)
      {
          ISubscriptionUsersClient subscriptionUsersClient = 
              new SubscriptionUsersClient(httpClient);
       	await subscriptionUsersClient.RemoveUserAsync(subscriptionId, userId);
      }
      

      In this method, the function removes the user with the userId ID from the workspace with the subscriptionId ID.

    What next?

    • Work with groups
    • Help and feedback
    Back to top 2025.2.6 © 1998-2025 Copyright Fast Reports Inc.