示例#1
0
        public virtual void TestShareToLongMultiShare()
        {
            server.setResponseBody("../../../TestSDK/resources/shareToMany.json");

            MultiShare share = new MultiShare();

            share.AccessLevel = AccessLevel.ADMIN;
            share.Message     = "I have shared a Smartsheet with you. Please review it for the latest updates";
            share.Subject     = "Testing";
            share.CCMe        = false;

            IList <User> users = new List <User>();
            User         user  = new User();

            user.Email = "*****@*****.**";
            users.Add(user);
            user.Email = "*****@*****.**";
            users.Add(user);
            share.Users = users;

            IList <Share> shares = shareResourcesImpl.ShareTo(1234L, share);

            Assert.True(shares.Count == 2);
            Assert.AreEqual("*****@*****.**", shares[0].Email);
            Assert.AreEqual("*****@*****.**", shares[1].Email);
        }
示例#2
0
 /// <summary>
 /// Share the object with multiple Users.
 ///
 /// It mirrors To the following Smartsheet REST API method: POST /workspace/{Id}/multishare POST
 /// /sheet/{Id}/multishare
 ///
 /// Exceptions:
 ///   IllegalArgumentException : if multiShare 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="objectId"> the ID of the object To share </param>
 /// <param name="multiShare"> the MultiShare object </param>
 /// <param name="sendEmail"> whether To send Email </param>
 /// <returns> the created shares </returns>
 /// <exception cref="SmartsheetException"> the Smartsheet exception </exception>
 public virtual IList <Share> ShareTo(long objectId, MultiShare multiShare, bool sendEmail)
 {
     return(this.PostAndReceiveList <MultiShare, Share>(MasterResourceType + "/" + objectId + "/multishare?sendEmail=" + sendEmail, multiShare, typeof(Share)));
 }