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

ShareTo() public method

Shares a Sheet with the specified Users and Groups.

It mirrors To the following Smartsheet REST API method:
POST /workspaces/{workspaceId}/shares
POST /sheets/{sheetId}/shares
POST /sights/{sightsId}/shares
POST /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 ShareTo ( long objectId, IEnumerable shares, bool sendEmail ) : IList
objectId long the Id of the object
shares IEnumerable the share objects
sendEmail bool (optional): Either true or false to indicate whether or not /// to notify the user by email. Default is false.
return IList
        public virtual IList<Share> ShareTo(long objectId, IEnumerable<Share> shares, bool? sendEmail)
        {
            StringBuilder path = new StringBuilder(MasterResourceType + "/" + objectId + "/shares");
            if (sendEmail != null)
            {
                path.Append("?sendEmail=" + sendEmail.ToString().ToLower());
            }
            return this.PostAndReceiveList<IEnumerable<Share>, Share>(path.ToString(), shares, typeof(Share));
        }

Usage Example

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

            Share share = new Share();

            share.Email       = "*****@*****.**";
            share.AccessLevel = AccessLevel.ADMIN;
            shareResourcesImpl.ShareTo(1234L, share);

            Assert.AreEqual("*****@*****.**", share.Email);
            Assert.AreEqual(AccessLevel.ADMIN, share.AccessLevel);
        }
All Usage Examples Of Smartsheet.Api.Internal.ShareResourcesImpl::ShareTo