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
Esempio 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);
        }
		public virtual void TestShareTo()
		{
			server.setResponseBody("../../../TestSDK/resources/shareToOne.json");

			Share share = new Share.CreateShareBuilder("*****@*****.**", AccessLevel.EDITOR).Build();
			IList<Share> shares = shareResourcesImpl.ShareTo(1234L, new Share[] { share }, true);

			Assert.AreEqual("*****@*****.**", shares[0].Email);
			Assert.AreEqual(AccessLevel.EDITOR, shares[0].AccessLevel);
			Assert.AreEqual("AAAFeF82FOeE", shares[0].Id);
			Assert.AreEqual(ShareType.USER, shares[0].Type);
			Assert.AreEqual("Jane Doe", shares[0].Name);

		}