Smartsheet.Api.Internal.DiscussionCommentResourcesImpl.AddComment C# (CSharp) Method

AddComment() public method

Adds a Comment to a Discussion.

It mirrors To the following Smartsheet REST API method: POST /sheets/{sheetId}/discussions/{discussionId}/comments

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 AddComment ( long sheetId, long discussionId, Comment comment ) : Comment
sheetId long the id of the sheet
discussionId long the id of the discussion
comment Smartsheet.Api.Models.Comment Comment object
return Smartsheet.Api.Models.Comment
        public virtual Comment AddComment(long sheetId, long discussionId, Comment comment)
        {
            return this.CreateResource("sheets/" + sheetId + "/discussions/" + discussionId + "/comments", typeof(Comment), comment);
        }

Usage Example

Example #1
0
        public virtual void TestAddComment()
        {
            Comment comment = new Comment.AddCommentBuilder("This is a new comment.").Build();

            server.setResponseBody("../../../TestSDK/resources/addComment.json");
            comment = commentResources.AddComment(8357140688594820, 5773448686397316, comment);

            Assert.IsTrue(comment.CreatedBy.Email == "*****@*****.**");
            Assert.IsTrue(comment.Id == 6834973207488388);
            Assert.IsTrue(comment.Text == "This is a new comment.");
        }