Skip to main content

RemoveReplies

Removes the specified comment replies.

Syntax​

expression.RemoveReplies(nPos, nCount, bRemoveAll);

expression - A variable that represents a ApiComment class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
nPosOptionalNumber0The position of the first comment reply to remove.
nCountOptionalNumber1A number of comment replies to remove.
bRemoveAllOptionalbooleanfalseSpecifies whether to remove all comment replies or not.

Returns​

ApiComment

Example​

Remove all replies from a comment in a document.

// How do I delete all replies attached to a comment in a document?

// Clear every reply from a comment to reset the discussion thread to a clean state.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is just a sample text");
Api.AddComment(paragraph, "comment", "John Smith");
let comments = doc.GetAllComments();
comments[0].AddReply("reply1", "Mark Potato", "uid-2", 0);
comments[0].RemoveReplies();
paragraph = Api.CreateParagraph();
paragraph.AddText("The comment replies were removed");
doc.Push(paragraph);