/// <summary>
        /// Private routine to import a sheet of contentType into a workspace
        /// </summary>
        /// <param name="workspaceId"></param>
        /// <param name="file"></param>
        /// <param name="sheetName"></param>
        /// <param name="headerRowIndex"></param>
        /// <param name="primaryColumnIndex"></param>
        /// <param name="contentType"></param>
        /// <returns> the created sheet </returns>
        private Sheet ImportSheet(long workspaceId, string file, string sheetName, int?headerRowIndex, int?primaryColumnIndex, string contentType)
        {
            Utility.Utility.ThrowIfNull(file);

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

            if (sheetName == null)
            {
                FileInfo fi = new FileInfo(file);
                parameters.Add("sheetName", fi.Name);
            }
            else
            {
                parameters.Add("sheetName", sheetName);
            }
            if (headerRowIndex != null)
            {
                parameters.Add("headerRowIndex", headerRowIndex.ToString());
            }
            if (primaryColumnIndex != null)
            {
                parameters.Add("primaryColumnIndex", primaryColumnIndex.ToString());
            }
            string path = "workspaces/" + workspaceId + "/sheets/import" + QueryUtil.GenerateUrl(null, parameters);

            return(this.ImportFile <Sheet>(path, file, contentType));
        }
        /// <summary>
        /// <para>Get a sheet.</para>
        ///
        /// <para>It mirrors To the following Smartsheet REST API method: GET /sheets/{sheetId}</para>
        /// </summary>
        /// <param name="sheetId"> the Id of the sheet </param>
        /// <param name="includes"> used To specify the optional objects To include. </param>
        /// <param name="excludes"> used To specify the optional objects To include. </param>
        /// <param name="rowIds"> used To specify the optional objects To include. </param>
        /// <param name="rowNumbers"> used To specify the optional objects To include. </param>
        /// <param name="columnIds"> used To specify the optional objects To include. </param>
        /// <param name="pageSize"> used To specify the optional objects To include. </param>
        /// <param name="page"> used To specify the optional objects To include. </param>
        /// <returns> the sheet resource (note that if there is no such resource, this method will throw
        /// ResourceNotFoundException rather than returning null). </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual Sheet GetSheet(long sheetId, IEnumerable <SheetLevelInclusion> includes, IEnumerable <SheetLevelExclusion> excludes, IEnumerable <long> rowIds, IEnumerable <int> rowNumbers, IEnumerable <long> columnIds, long?pageSize, long?page)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (includes != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(includes));
            }
            if (excludes != null)
            {
                parameters.Add("exclude", QueryUtil.GenerateCommaSeparatedList(excludes));
            }
            if (rowIds != null)
            {
                parameters.Add("rowIds", QueryUtil.GenerateCommaSeparatedList(rowIds));
            }
            if (rowNumbers != null)
            {
                parameters.Add("rowNumbers", QueryUtil.GenerateCommaSeparatedList(rowNumbers));
            }
            if (columnIds != null)
            {
                parameters.Add("columnIds", QueryUtil.GenerateCommaSeparatedList(columnIds));
            }
            if (pageSize != null)
            {
                parameters.Add("pageSize", pageSize.ToString());
            }
            if (page != null)
            {
                parameters.Add("page", page.ToString());
            }

            return(this.GetResource <Sheet>("sheets/" + sheetId + QueryUtil.GenerateUrl(null, parameters), typeof(Sheet)));
        }
        /// <summary>
        /// <para>Creates a copy of the specified Sheet.</para>
        /// <para>It mirrors To the following Smartsheet REST API method:<br />
        /// POST /sheets/{sheetId}/copy</para>
        /// </summary>
        /// <param name="sheetId"> the sheet Id </param>
        /// <param name="destination"> the destination to copy to </param>
        /// <param name="include"> the elements to copy. Note: Cell history will not be copied, regardless of which include parameter values are specified.</param>
        /// <returns> the created folder </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual Sheet CopySheet(long sheetId, ContainerDestination destination, IEnumerable <SheetCopyInclusion> include)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (include != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include));
            }
            return(this.CreateResource <RequestResult <Sheet>, ContainerDestination>(QueryUtil.GenerateUrl("sheets/" + sheetId + "/copy", parameters), destination).Result);
        }
        /// <summary>
        /// <para>Gets a specified Sight.</para>
        ///
        /// <para>Mirrors to the following Smartsheet REST API method: GET /sights/{sightId}</para>
        /// </summary>
        /// <param name="sightId"> the Id of the Sight </param>
        /// <param name="level"> compatibility level </param>
        /// <returns> the Sight resource (note that if there is no such resource, this method will throw
        /// ResourceNotFoundException rather than returning null). </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or an empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual Sight GetSight(long sightId, int?level)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (level != null)
            {
                parameters.Add("level", level.ToString());
            }
            return(this.GetResource <Sight>("sights/" + sightId + QueryUtil.GenerateUrl(null, parameters), typeof(Sight)));
        }
Пример #5
0
        /// <summary>
        /// <para>Revokes the access token used to make this request. The access token will no longer be valid, and subsequent API calls made using the token will fail.</para>
        /// <para>It mirrors to the following Smartsheet REST API method:<br />
        /// DELETE /token</para>
        /// </summary>
        ///
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual void RevokeAccessToken(bool?deleteAllForApiClient)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (deleteAllForApiClient != null)
            {
                parameters.Add("deleteAllForApiClient", deleteAllForApiClient.ToString());
            }
            this.DeleteResource <Token>("token" + QueryUtil.GenerateUrl(null, parameters), typeof(Token));
        }
        /// <summary>
        /// <para>Get the current user.</para>
        /// <para>It mirrors to the following Smartsheet REST API method: GET /users/me</para>
        /// </summary>
        /// <param name="includes">used to specify the optional objects to include.</param>
        /// <returns> the current user </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual UserProfile GetCurrentUser(IEnumerable <UserInclusion> includes)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (includes != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(includes));
            }

            return(this.GetResource <UserProfile>("users/me" + QueryUtil.GenerateUrl(null, parameters), typeof(UserProfile)));
        }
        /// <summary>
        /// <para>Gets the list of all Webhooks that the user owns (if a user generated token was used to make the request)
        /// or the list of all Webhooks associated with the third-party app (if a third-party app made the request). Items
        /// in the response are ordered by API Client name, then Webhook name, then creation date.</para>
        ///
        /// <para>It mirrors to the following Smartsheet REST API method: GET /webhooks</para>
        /// </summary>
        /// <returns>IndexResult object containing an array of Webhook objects</returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <Webhook> ListWebhooks(PaginationParameters paging)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }

            return(this.ListResourcesWithWrapper <Webhook>("webhooks" + QueryUtil.GenerateUrl(null, parameters)));
        }
        private string PassthroughRequest(HttpMethod method, string endpoint, string payload, IDictionary <string, string> parameters)
        {
            Utils.ThrowIfNull(endpoint);
            Utils.ThrowIfEmpty(endpoint);

            if (parameters != null)
            {
                endpoint += QueryUtil.GenerateUrl(null, parameters);
            }

            HttpRequest request = null;

            try
            {
                request = CreateHttpRequest(new Uri(this.smartsheet.BaseURI, endpoint), method);
            }
            catch (Exception e)
            {
                throw new SmartsheetException(e);
            }

            if (payload != null)
            {
                HttpEntity entity = new HttpEntity();
                entity.ContentType = "application/json";
                byte[] bytes = Encoding.UTF8.GetBytes(payload);
                entity.Content       = bytes;
                entity.ContentLength = bytes.Length;
                request.Entity       = entity;
            }

            HttpResponse response = this.smartsheet.HttpClient.Request(request);

            string res = null;

            switch (response.StatusCode)
            {
            case HttpStatusCode.OK:
                StreamReader sr = response.Entity.GetContent();
                MemoryStream ms = new MemoryStream();
                sr.BaseStream.CopyTo(ms);
                byte[] bytes = ms.ToArray();
                res = Encoding.UTF8.GetString(bytes);
                break;

            default:
                HandleError(response);
                break;
            }

            smartsheet.HttpClient.ReleaseConnection();

            return(res);
        }
        /// <summary>
        /// <para>Gets the list of all Sights that the user has access to.</para>
        ///
        /// <para>Mirrors to the following Smartsheet REST API method: GET /sights</para>
        /// </summary>
        /// <returns>IndexResult object containing an array of Sight objects limited to the following attributes:
        ///        id, name, accessLevel, permalink, createdAt, modifiedAt
        /// </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or an empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <Sight> ListSights(PaginationParameters paging, DateTime?modifiedSince)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }

            return(this.ListResourcesWithWrapper <Sight>("sights" + QueryUtil.GenerateUrl(null, parameters)));
        }
        /// <summary>
        /// <para>Deletes one or more row(s) from the Sheet</para>
        /// <para>It mirrors to the following Smartsheet REST API method: DELETE /sheets/{sheetId}/rows?ids={rowId1},{rowId2},{rowId3}...</para>
        /// <remarks>This operation will delete ALL child Rows of the specified Row(s).</remarks>
        /// </summary>
        /// <param name="sheetId"> The sheet ID </param>
        /// <param name="ids"> The list of row IDs </param>
        /// <param name="ignoreRowsNotFound"> If set to false and any of the specified Row IDs are not found, no rows will be deleted, and the “not found” error will be returned.</param>
        /// <returns>Row IDs corresponding to all rows that were successfully deleted (including any child rows of rows specified in the URL).</returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual IList <long> DeleteRows(long sheetId, IEnumerable <long> ids, bool?ignoreRowsNotFound)
        {
            Utility.Utility.ThrowIfNull(ids);
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("ids", QueryUtil.GenerateCommaSeparatedList(ids));
            if (ignoreRowsNotFound.HasValue)
            {
                parameters.Add("ignoreRowsNotFound", ignoreRowsNotFound.Value.ToString());
            }
            return(this.DeleteResource <IList <long> >(QueryUtil.GenerateUrl("sheets/" + sheetId + "/rows", parameters)));
        }
Пример #11
0
        /// <summary>
        /// <para>Gets all cross-sheet references for this sheet.</para>
        /// <para>Mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/crosssheetreferences</para>
        /// </summary>
        /// <param name="sheetId"> the Id of the sheet </param>
        /// <param name="paging"> the pagination parameters </param>
        /// <returns> a list of cross sheet references </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or an empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <CrossSheetReference> ListCrossSheetReferences(long sheetId, PaginationParameters paging)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }

            return(this.ListResourcesWithWrapper <CrossSheetReference>("sheets/" + sheetId + "/crosssheetreferences" +
                                                                       QueryUtil.GenerateUrl(null, parameters)));
        }
 /// <summary>
 /// <para>Gets the specified Workspace (and lists its contents).</para>
 /// <para>It mirrors to the following Smartsheet REST API method: GET /workspaces/{workspaceid}</para>
 /// <remarks><para>By default, this operation only returns the top-level items in the Workspace. To load all of the contents, 
 /// including nested Folders, include the loadAll query string parameter with a value of true.</para>
 /// <para>If no Folders, Sheets, Reports, or Templates are present in the Workspace, the corresponding attribute 
 /// (e.g., "folders", "sheets") will not be present in the response object.</para></remarks>
 /// </summary>
 /// <param name="workspaceId">the workspace id</param>
 /// <param name="loadAll"> Defaults to false. If true, loads all of the contents, including nested Folders. </param>
 /// <param name="include"> When specified with a value of "source", response will include the source for any sheet that was created from another sheet or template</param>
 /// <returns> the workspace (note that if there is no such resource, this method will throw ResourceNotFoundException
 /// rather than returning null) </returns>
 /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
 /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
 /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
 /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
 /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
 /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
 public virtual Workspace GetWorkspace(long workspaceId, bool? loadAll, IEnumerable<WorkspaceInclusion> include)
 {
     IDictionary<string, string> parameters = new Dictionary<string, string>();
     if (loadAll.HasValue)
     {
         parameters.Add("loadAll", loadAll.ToString());
     }
     if (include != null)
     {
         parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include));
     }
     return this.GetResource<Workspace>(QueryUtil.GenerateUrl("workspaces/" + workspaceId, parameters), typeof(Workspace));
 }
        /// <summary>
        /// <para>Adds an image to the sheet summary field.</para>
        /// <para>Mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/summary/fields/{fieldId}/images</para>
        /// </summary>
        /// <param name="sheetId"> the sheet id </param>
        /// <param name="fieldId"> the summary field id </param>
        /// <param name="file"> the file path </param>
        /// <param name="fileType"> the file type </param>
        /// <param name="altText"> image alternate text </param>
        /// <returns> Result </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or an empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual SummaryField AddSheetSummaryFieldImage(long sheetId, long fieldId, string file, string fileType, string altText)
        {
            string path = "sheets/" + sheetId + "/summary/fields/" + fieldId + "/images";

            Utility.Utility.ThrowIfNull(file);

            if (fileType == null)
            {
                fileType = "application/octet-stream";
            }

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

            if (altText != null)
            {
                parameters.Add("altText", altText);
            }

            path = QueryUtil.GenerateUrl(path, parameters);

            FileInfo    fi      = new FileInfo(file);
            HttpRequest request = CreateHttpRequest(new Uri(this.Smartsheet.BaseURI, path), HttpMethod.POST);

            request.Headers["Content-Disposition"] = "attachment; filename=\"" + fi.Name + "\"";

            HttpEntity entity = new HttpEntity();

            entity.ContentType = fileType;

            entity.Content       = File.ReadAllBytes(file);
            entity.ContentLength = fi.Length;
            request.Entity       = entity;

            HttpResponse response = this.Smartsheet.HttpClient.Request(request);

            SummaryField summaryField = null;

            switch (response.StatusCode)
            {
            case HttpStatusCode.OK:
                summaryField = this.smartsheet.JsonSerializer.deserializeResult <SummaryField>(response.Entity.GetContent()).Result;
                break;

            default:
                HandleError(response);
                break;
            }

            this.Smartsheet.HttpClient.ReleaseConnection();
            return(summaryField);
        }
        /// <summary>
        /// <para>List of all Sheets owned by the members of the account (organization).</para>
        /// <para>It mirrors To the following Smartsheet REST API method: GET /users/sheets</para>
        /// </summary>
        /// <returns> the list of all Sheets owned by the members of the account (organization). </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <Sheet> ListOrgSheets(PaginationParameters paging, DateTime?modifiedSince)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }
            if (modifiedSince != null)
            {
                parameters.Add("modifiedSince", ((DateTime)modifiedSince).ToUniversalTime().ToString("o"));
            }
            return(this.ListResourcesWithWrapper <Sheet>("users/sheets" + QueryUtil.GenerateUrl(null, parameters)));
        }
        /// <summary>
        /// <para>Gets the Row specified in the URL.</para>
        /// <para>It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/rows/{rowId}</para>
        /// </summary>
        /// <param name="include"> comma-separated list of elements to include in the response. </param>
        /// <param name="exclude"> a comma-separated list of optional objects to exclude in the response. </param>
        /// <param name="sheetId"> the sheetId </param>
        /// <param name="rowId"> the rowId </param>
        /// <returns> the row object </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual Row GetRow(long sheetId, long rowId, IEnumerable <RowInclusion> include, IEnumerable <RowExclusion> exclude)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            if (include != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include));
            }
            if (exclude != null)
            {
                parameters.Add("exclude", QueryUtil.GenerateCommaSeparatedList(exclude));
            }
            return(this.GetResource <Row>("sheets/" + sheetId + "/rows/" + rowId + QueryUtil.GenerateUrl(null, parameters), typeof(Row)));
        }
        /// <summary>
        /// <para>
        /// Gets a nested list of all Home objects, including folders, reports, sheets, templates, and workspaces as shown on the Home tab.
        /// </para>
        /// <para>
        /// Mirrors to the following Smartsheet REST API method: GET /home
        /// </para>
        /// </summary>
        /// <param name="includes"> used to specify the optional objects to include, currently TEMPLATES is supported. </param>
        /// <param name="excludes"> used to specify the optional object to exclude </param>
        /// <exception cref="InvalidRequestException">if there is any problem with the REST API request</exception>
        /// <exception cref="AuthorizationException">if there is any problem with the REST API authorization (access token)</exception>
        /// <exception cref="InvalidRequestException">if the resource cannot be found</exception>
        /// <exception cref="ResourceNotFoundException">if the REST API service is not available (possibly due to rate limiting)</exception>
        /// <exception cref="ServiceUnavailableException">if any other REST API related error occurred during the operation</exception>
        /// <exception cref="SmartsheetException">if any other error occurred during the operation</exception>
        /// <returns> the resource (note that if there is no such resource, this method will throw ResourceNotFoundException
        /// rather than returning null). </returns>
        public virtual Home GetHome(IEnumerable <HomeInclusion> includes, IEnumerable <HomeExclusion> excludes)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (includes != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(includes));
            }
            if (excludes != null)
            {
                parameters.Add("exclude", QueryUtil.GenerateCommaSeparatedList(excludes));
            }
            return(this.GetResource <Home>("home" + QueryUtil.GenerateUrl(null, parameters), typeof(Home)));
        }
Пример #17
0
        /// <summary>
        /// <para>Gets the cell modification history.</para>
        /// <para>It mirrors To the following Smartsheet REST API method: GET /sheets/{sheetId}/rows/{rowId}/columns/{columnId}/history</para>
        /// <remarks><para>This operation supports pagination of results. For more information, see Paging.</para>
        /// <para>This is a resource-intensive operation and incurs 10 additional requests against the rate limit.</para></remarks>
        /// </summary>
        /// <param name="sheetId"> the sheet Id </param>
        /// <param name="rowId"> the row Id </param>
        /// <param name="columnId"> the column id</param>
        /// <param name="include"> the elements to include in the response </param>
        /// <param name="paging"> the pagination </param>
        /// <returns> the row object </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <CellHistory> GetCellHistory(long sheetId, long rowId, long columnId, IEnumerable <CellInclusion> include, PaginationParameters paging)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }
            if (include != null)
            {
                parameters.Add("include", Util.QueryUtil.GenerateCommaSeparatedList(include));
            }
            return(this.ListResourcesWithWrapper <CellHistory>(QueryUtil.GenerateUrl("sheets/" + sheetId + "/rows/" + rowId + "/columns/" + columnId + "/history", parameters)));
        }
        /// <summary>
        /// <para>Get a specified Sight.</para>
        ///
        /// <para>It mirrors to the following Smartsheet REST API method: GET /sights/{sightId}</para>
        /// </summary>
        /// <param name="sightId"> the Id of the sight </param>
        /// <param name="includes">used to specify the optional objects to include.</param>
        /// <param name="level"> compatibility level </param>
        /// <returns> the sight resource (note that if there is no such resource, this method will throw
        /// ResourceNotFoundException rather than returning null). </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual Sight GetSight(long sightId, IEnumerable <SightInclusion> includes, int?level)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (includes != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(includes));
            }
            if (level != null)
            {
                parameters.Add("level", level.ToString());
            }
            return(this.GetResource <Sight>("sights/" + sightId + QueryUtil.GenerateUrl(null, parameters), typeof(Sight)));
        }
Пример #19
0
        /// <summary>
        /// <para>Gets a list of all Discussions associated with the specified Sheet (both sheet-level discussions and row-level discussions).</para>
        /// <para>It mirrors To the following Smartsheet REST API method: GET /sheets/{sheetId}/discussions</para>
        /// <remarks>This operation supports pagination of results. For more information, see Paging.</remarks>
        /// </summary>
        /// <param name="sheetId"> the sheet Id </param>
        /// <param name="include">elements to include in response</param>
        /// <param name="paging">the pagination</param>
        /// <returns> list of all Discussions </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <Discussion> ListDiscussions(long sheetId, IEnumerable <DiscussionInclusion> include, PaginationParameters paging)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }
            if (include != null)
            {
                parameters.Add("include", Util.QueryUtil.GenerateCommaSeparatedList(include));
            }
            return(this.ListResourcesWithWrapper <Discussion>(QueryUtil.GenerateUrl("sheets/" + sheetId + "/discussions", parameters)));
        }
        /// <summary>
        /// <para>Lists all user alternate emails.</para>
        /// <para>Mirrors to the following Smartsheet REST API method: GET /users/{userId}/alternateemails</para>
        /// </summary>
        /// <param name="userId"> the Id of the user </param>
        /// <param name="pagination"> the pagination</param>
        /// <returns> the list of all AlternateEmails </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or an empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public PaginatedResult <AlternateEmail> ListAlternateEmails(long userId, PaginationParameters pagination)
        {
            StringBuilder path = new StringBuilder("users/" + userId + "/alternateemails");

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

            if (pagination != null)
            {
                parameters = pagination.toDictionary();
            }
            path.Append(QueryUtil.GenerateUrl(null, parameters));

            return(this.ListResourcesWithWrapper <AlternateEmail>(path.ToString()));
        }
Пример #21
0
        /// <summary>
        /// <para>Gets the list of all Sheets that the User has access to, in alphabetical order, by name.</para>
        ///
        /// <para>It mirrors To the following Smartsheet REST API method: GET /Sheets</para>
        /// </summary>
        /// <returns> A list of all Sheets (note that an empty list will be returned if there are none). </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <Sheet> ListSheets(IEnumerable <SheetInclusion> includes, PaginationParameters paging)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }
            if (includes != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(includes));
            }
            return(this.ListResourcesWithWrapper <Sheet>("sheets" + QueryUtil.GenerateUrl(null, parameters)));
        }
        /// <summary>
        /// Attach file.
        /// </summary>
        /// <param name="path"> the url path </param>
        /// <param name="file"> the file </param>
        /// <param name="contentType"> the content Type </param>
        /// <param name="overrideValidation"> override column validation </param>
        /// <param name="altText"> image alternate text </param>
        /// <returns> the attachment </returns>
        /// <exception cref="FileNotFoundException"> the file not found exception </exception>
        /// <exception cref="SmartsheetException"> the Smartsheet exception </exception>
        private void AddImage(string path, string file, string contentType, bool overrideValidation, string altText)
        {
            Utility.Utility.ThrowIfNull(file);

            if (contentType == null)
            {
                contentType = "application/octet-stream";
            }

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

            if (altText != null)
            {
                parameters.Add("altText", altText);
            }
            if (overrideValidation)
            {
                parameters.Add("overrideValidation", "true");
            }

            path = QueryUtil.GenerateUrl(path, parameters);

            FileInfo    fi      = new FileInfo(file);
            HttpRequest request = CreateHttpRequest(new Uri(this.Smartsheet.BaseURI, path), HttpMethod.POST);

            request.Headers["Content-Disposition"] = "attachment; filename=\"" + fi.Name + "\"";

            HttpEntity entity = new HttpEntity();

            entity.ContentType = contentType;

            entity.Content       = File.ReadAllBytes(file);
            entity.ContentLength = fi.Length;
            request.Entity       = entity;

            HttpResponse response = this.Smartsheet.HttpClient.Request(request);

            switch (response.StatusCode)
            {
            case HttpStatusCode.OK:
                break;

            default:
                HandleError(response);
                break;
            }

            this.Smartsheet.HttpClient.ReleaseConnection();
        }
Пример #23
0
        /// <summary>
        /// <para>Gets a list of all Columns belonging to the Sheet specified in the URL.</para>
        /// <para>It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/columns</para>
        /// <remarks>This operation supports pagination of results. For more information, see Paging.</remarks>
        /// </summary>
        /// <param name="sheetId"> the sheet Id </param>
        /// <param name="include">elements to include in response</param>
        /// <param name="paging">the paging</param>
        /// <returns> the list of Columns (note that an empty list will be returned if there is none) </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <Column> ListColumns(long sheetId, IEnumerable <ColumnInclusion> include, PaginationParameters paging)
        {
            StringBuilder path = new StringBuilder("sheets/" + sheetId + "/columns");
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }
            if (include != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include));
            }
            return(this.ListResourcesWithWrapper <Column>(QueryUtil.GenerateUrl("sheets/" + sheetId + "/columns", parameters)));
        }
        public virtual void TestGenerateUrl()
        {
            Assert.AreEqual("", QueryUtil.GenerateUrl(null, null));
            Assert.AreEqual("url", QueryUtil.GenerateUrl("url", null));

            Dictionary <string, string> map = new Dictionary <string, string>();

            map.Add("param1", "1");
            map.Add("param2", "2");
            Assert.AreEqual("?param1=1&param2=2", QueryUtil.GenerateUrl(null, map));
            map.Clear();

            map.Add("param3", null);
            Assert.AreEqual("?param3=", QueryUtil.GenerateUrl(null, map));
        }
Пример #25
0
        ///// <summary>
        ///// Add a user To the organization, without sending Email.
        /////
        ///// It mirrors To the following Smartsheet REST API method: POST /Users
        /////
        ///// Exceptions:
        /////   - IllegalArgumentException : if any argument is null
        /////   - InvalidRequestException : if there is any problem with the REST API request
        /////   - AuthorizationException : if there is any problem with the REST API authorization(access token)
        /////   - ResourceNotFoundException : if the resource can not be found
        /////   - ServiceUnavailableException : if the REST API service is not available (possibly due To rate limiting)
        /////   - SmartsheetRestException : if there is any other REST API related error occurred during the operation
        /////   - SmartsheetException : if there is any other error occurred during the operation
        ///// </summary>
        ///// <param name="user"> the user object limited To the following attributes: * Admin * Email * LicensedSheetCreator </param>
        ///// <returns> the user </returns>
        ///// <exception cref="SmartsheetException"> the Smartsheet exception </exception>
        //public virtual User AddUser(User user)
        //{
        //	return this.CreateResource<User>("users", typeof(User), user);
        //}

        /// <summary>
        /// <para>Add a user To the organization</para>
        /// <para>It mirrors To the following Smartsheet REST API method: POST /Users</para>
        /// </summary>
        /// <param name="user"> the user </param>
        /// <param name="sendEmail"> flag indicating whether or not to send a welcome email. Defaults to false. </param>
        /// <param name="allowInviteAccountAdmin">if user is an admin in another organization, setting to true will invite their entire organization.</param>
        /// <returns> the created user </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual User AddUser(User user, bool?sendEmail, bool?allowInviteAccountAdmin)
        {
            StringBuilder path = new StringBuilder("users");
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (sendEmail.HasValue)
            {
                parameters.Add("sendEmail", sendEmail.Value.ToString());
            }
            if (allowInviteAccountAdmin.HasValue)
            {
                parameters.Add("allowInviteAccountAdmin", allowInviteAccountAdmin.Value.ToString());
            }
            return(this.CreateResource <User>(QueryUtil.GenerateUrl("users", parameters), typeof(User), user));
        }
        /// <summary>
        /// <para>Moves Row(s) from the Sheet specified in the URL to (the bottom of) another sheet.</para>
        /// <para>It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/copy</para>
        /// <remarks><para>Up to 5,000 row IDs can be specified in the request,
        /// but if the total number of rows in the destination sheet after the copy exceeds the Smartsheet row limit,
        /// an error response will be returned.</para>
        /// <para>Any child rows of the rows specified in the request will also be moved.
        /// Parent-child relationships amongst rows will be preserved within the destination sheet.</para></remarks>
        /// </summary>
        /// <param name="sheetId"> the sheet Id </param>
        /// <param name="ignoreRowsNotFound"> ignoreRowsNotFound </param>
        /// <param name="directive"> directive </param>
        /// <param name="include">the elements to include.</param>
        /// <returns> CopyOrMoveRowResult object </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual CopyOrMoveRowResult MoveRowsToAnotherSheet(long sheetId, CopyOrMoveRowDirective directive, IEnumerable <MoveRowInclusion> include, bool?ignoreRowsNotFound)
        {
            Utility.Utility.ThrowIfNull(directive);
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (include != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include));
            }
            if (ignoreRowsNotFound.HasValue)
            {
                parameters.Add("ignoreRowsNotFound", ignoreRowsNotFound.ToString().ToLower());
            }
            return(this.CreateResource <CopyOrMoveRowResult, CopyOrMoveRowDirective>(QueryUtil.GenerateUrl("sheets/" + sheetId + "/rows/move", parameters), directive));
        }
Пример #27
0
        /// <summary>
        /// <para>Removes a User from an organization. User is transitioned to a free collaborator with read-only access to owned sheets (unless those are optionally transferred to another user).</para>
        /// <remarks>This operation is only available to system administrators.</remarks>
        /// <para>It mirrors To the following Smartsheet REST API method: DELETE /user{Id}</para>
        /// </summary>
        /// <param name="userId"> the Id of the user </param>
        /// <param name="transferTo">(required if user owns groups): The ID of the user to transfer ownership to.
        /// If the user being deleted owns groups, they will be transferred to this user.
        /// If the user owns sheets, and transferSheets is true, then the deleted user’s sheets will be transferred to this user.</param>
        /// <param name="transferSheets">If true, and transferTo is specified, the deleted user’s sheets will be transferred. Else, sheets will not be transferred. Defaults to false.</param>
        /// <param name="removeFromSharing">Set to true to remove the user from sharing for all sheets/workspaces in the organization. If not specified, User will not be removed from sharing.</param>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual void RemoveUser(long userId, long?transferTo, bool?transferSheets, bool?removeFromSharing)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (transferTo != null)
            {
                parameters.Add("transferTo", transferTo.ToString());
            }
            if (transferSheets != null)
            {
                parameters.Add("transferSheets", transferSheets.ToString());
            }
            if (removeFromSharing != null)
            {
                parameters.Add("removeFromSharing", removeFromSharing.ToString());
            }
            this.DeleteResource <User>("users/" + userId + QueryUtil.GenerateUrl(null, parameters), typeof(User));
        }
        /// <summary>
        /// <para>Inserts one or more rows into the Sheet specified in the URL with allowPartialSuccess.</para>
        ///
        /// <para>It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/rows?allowPartialSuccess=true</para>
        /// <remarks>If multiple rows are specified in the request, all rows must be inserted at the same location
        /// (i.e. the toTop, toBottom, parentId, siblingId, and above attributes must be the same for all rows in the request).</remarks>
        /// </summary>
        /// <param name="sheetId"> the sheet Id </param>
        /// <param name="rows"> one or more rows </param>
        /// <returns> the list of created Rows </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual BulkItemRowResult AddRowsAllowPartialSuccess(long sheetId, IEnumerable <Row> rows)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("allowPartialSuccess", "true");

            foreach (Row row in rows)
            {
                row.Id = null;
            }

            HttpRequest request = null;

            try
            {
                request = CreateHttpRequest(new Uri(this.Smartsheet.BaseURI, QueryUtil.GenerateUrl("sheets/" + sheetId + "/rows", parameters)), HttpMethod.POST);
            }
            catch (Exception e)
            {
                throw new SmartsheetException(e);
            }

            request.Entity = serializeToEntity <IEnumerable <Row> >(rows);

            HttpResponse response = this.Smartsheet.HttpClient.Request(request);

            BulkItemRowResult bulkItemResult = null;

            switch (response.StatusCode)
            {
            case HttpStatusCode.OK:
                bulkItemResult = this.Smartsheet.JsonSerializer.deserialize <BulkItemRowResult>(response.Entity.GetContent());
                break;

            default:
                HandleError(response);
                break;
            }

            Smartsheet.HttpClient.ReleaseConnection();

            return(bulkItemResult);
        }
        /// <summary>
        /// <para>Gets the list of all Sheets that the User has access to, in alphabetical order, by name.</para>
        ///
        /// <para>It mirrors To the following Smartsheet REST API method: GET /Sheets</para>
        /// </summary>
        /// <returns> A list of all Sheets (note that an empty list will be returned if there are none). </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        public virtual PaginatedResult <Sheet> ListSheets(IEnumerable <SheetInclusion> includes, PaginationParameters paging, DateTime?modifiedSince)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            if (paging != null)
            {
                parameters = paging.toDictionary();
            }
            if (includes != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(includes));
            }
            if (modifiedSince != null)
            {
                parameters.Add("modifiedSince", ((DateTime)modifiedSince).ToUniversalTime().ToString("o"));
            }

            return(this.ListResourcesWithWrapper <Sheet>("sheets" + QueryUtil.GenerateUrl(null, parameters)));
        }
Пример #30
0
        /// <summary>
        /// <para>List all Users.</para>
        /// <para>It mirrors To the following Smartsheet REST API method: GET /Users</para>
        /// </summary>
        /// <param name="emails">list of emails</param>
        /// <param name="paging"> the pagination</param>
        /// <returns> the list of all Users </returns>
        /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception>
        /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception>
        /// <exception cref="AuthorizationException"> if there is any problem with  the REST API authorization (access token) </exception>
        /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception>
        /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due To rate limiting) </exception>
        /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception>
        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()));
        }