Word.CommentEventArgs interface
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Provides information about the comments that raised the comment event.
Remarks
API set: WordApi BETA (PREVIEW ONLY)
Used by
- Word.Body: onCommentAdded, onCommentChanged, onCommentDeleted, onCommentDeselected, onCommentSelected
- Word.ContentControl: onCommentAdded, onCommentChanged, onCommentDeselected, onCommentSelected
- Word.Paragraph: onCommentAdded, onCommentChanged, onCommentDeleted, onCommentDeselected, onCommentSelected
- Word.Range: onCommentAdded, onCommentChanged, onCommentDeselected, onCommentSelected
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/comment-events.yaml
async function onEventHandler(event: Word.CommentEventArgs) {
// Report the event source and the IDs of affected comments and replies.
const remoteSource: Word.EventSource = Word.EventSource.remote;
console.log(`${event.type} event. Source: ${event.source}.`);
if (event.source === remoteSource) {
console.log("A coauthor triggered this event.");
}
event.commentDetails.forEach((comment: Word.CommentDetail) => {
console.log("Affected comment:", { id: comment.id, replyIds: comment.replyIds });
});
}
Properties
| change |
Represents how the |
| comment |
Gets the |
| source | Specifies the source of the event. It can be local or remote (through coauthoring). |
| type | Specifies the event type. See |
Property Details
changeType
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Represents how the commentChanged event is raised.
changeType: Word.CommentChangeType | "none" | "edited" | "resolved" | "reopened" | "replyAdded" | "replyDeleted" | "replyEdited";
Property Value
Word.CommentChangeType | "none" | "edited" | "resolved" | "reopened" | "replyAdded" | "replyDeleted" | "replyEdited"
Remarks
commentDetails
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Gets the CommentDetail array which contains the IDs and reply IDs of the involved comments.
commentDetails: Word.CommentDetail[];
Property Value
Remarks
source
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the source of the event. It can be local or remote (through coauthoring).
source: Word.EventSource | "Local" | "Remote";
Property Value
Word.EventSource | "Local" | "Remote"
Remarks
type
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the event type. See Word.EventType for details.
type: Word.EventType | "ContentControlDeleted" | "ContentControlSelectionChanged" | "ContentControlDataChanged" | "ContentControlAdded" | "AnnotationAdded" | "AnnotationChanged" | "AnnotationDeleted" | "CommentDeleted" | "CommentSelected" | "CommentDeselected" | "CommentChanged" | "CommentAdded" | "ContentControlEntered" | "ContentControlExited" | "ParagraphAdded" | "ParagraphChanged" | "ParagraphDeleted" | "AnnotationClicked" | "AnnotationHovered" | "AnnotationInserted" | "AnnotationRemoved" | "AnnotationPopupAction";
Property Value
Word.EventType | "ContentControlDeleted" | "ContentControlSelectionChanged" | "ContentControlDataChanged" | "ContentControlAdded" | "AnnotationAdded" | "AnnotationChanged" | "AnnotationDeleted" | "CommentDeleted" | "CommentSelected" | "CommentDeselected" | "CommentChanged" | "CommentAdded" | "ContentControlEntered" | "ContentControlExited" | "ParagraphAdded" | "ParagraphChanged" | "ParagraphDeleted" | "AnnotationClicked" | "AnnotationHovered" | "AnnotationInserted" | "AnnotationRemoved" | "AnnotationPopupAction"