Smartsheet.Api.Internal.UserResourcesImpl.ListUsers C# (CSharp) Method

ListUsers() public method

List all Users.

It mirrors To the following Smartsheet REST API method: GET /Users

if any argument is null or empty string if there is any problem with the REST API request if there is any problem with the REST API authorization (access token) if the resource cannot be found if the REST API service is not available (possibly due To rate limiting) if there is any other error during the operation
public ListUsers ( IEnumerable emails, PaginationParameters paging ) : PaginatedResult
emails IEnumerable list of emails
paging PaginationParameters the pagination
return PaginatedResult
        public virtual PaginatedResult<User> ListUsers(IEnumerable<string> emails, PaginationParameters paging)
        {
            StringBuilder path = new StringBuilder("users");

            IDictionary<string, string> parameters = new Dictionary<string,string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }
            if (emails != null)
            {
                parameters.Add("email", string.Join(",", emails));
            }

            path.Append(QueryUtil.GenerateUrl(null, parameters));

            return this.ListResourcesWithWrapper<User>(path.ToString());
        }

Usage Example

Example #1
0
        public virtual void TestListUsers()
        {
            server.setResponseBody("../../../TestSDK/resources/listUsers.json");

            IList <User> users = userResources.ListUsers();

            Assert.NotNull(users);
            Assert.AreEqual(2, users.Count);
            Assert.AreEqual(94094820842L, (long)users[0].ID);
            Assert.AreEqual(true, users[0].Admin);
            Assert.AreEqual("*****@*****.**", users[0].Email);
            Assert.AreEqual("John Doe", users[0].Name);
            Assert.AreEqual(true, users[0].LicensedSheetCreator);
            Assert.AreEqual(UserStatus.ACTIVE, users[0].Status);
        }
All Usage Examples Of Smartsheet.Api.Internal.UserResourcesImpl::ListUsers