Smartsheet.Api.Internal.ShareResourcesImpl.ListShares C# (CSharp) Method

ListShares() public method

List shares of a given object.

It mirrors To the following Smartsheet REST API method:
GET /workspaces/{workspaceId}/shares
GET /sheets/{sheetId}/shares
GET /sights/{sightId}/shares
GET /reports/{reportId}/shares

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 ListShares ( long objectId, PaginationParameters paging, ShareScope shareScope ) : PaginatedResult
objectId long the object Id
paging Smartsheet.Api.Models.PaginationParameters the pagination request
shareScope Smartsheet.Api.Models.ShareScope when specified with a value of , the response will contain both item-level shares (scope=‘ITEM’) and workspace-level shares (scope='WORKSPACE’).
return PaginatedResult
        public virtual PaginatedResult<Share> ListShares(long objectId, PaginationParameters paging, ShareScope shareScope)
        {
            IDictionary<string, string> parameters = new Dictionary<string, string>();
            if (paging != null)
            {
                parameters = paging.toDictionary();
            }
            if (ShareScope.Workspace.Equals(shareScope))
            {
                parameters.Add("include", "workspaceShares");
            }

            return this.ListResourcesWithWrapper<Share>(MasterResourceType + "/" + objectId + "/shares" + QueryUtil.GenerateUrl(null, parameters));
        }

Usage Example

Ejemplo n.º 1
0
        public virtual void TestListShares()
        {
            server.setResponseBody("../../../TestSDK/resources/listShares.json");

            IList <Share> shares = shareResourcesImpl.ListShares(2906571706525572L);

            Assert.True(shares.Count == 2, "The number of shares returned is incorrect.");

            Assert.AreEqual("*****@*****.**", shares[0].Email, "Email attribute of the share is incorrect.");
            Assert.AreEqual("*****@*****.**", shares[1].Email, "Email attribute of the share is incorrect.");
        }
All Usage Examples Of Smartsheet.Api.Internal.ShareResourcesImpl::ListShares