メンションを含むコメントの投稿
この例では、postCommentToFeedElement(communityId, feedElementId, comment, feedElementFileUpload) をコールしてグループをメンションするコメントを投稿します。
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17String communityId = null;
18String feedElementId = '0D5D0000000KtW3';
19
20ConnectApi.CommentInput commentInput = new ConnectApi.CommentInput();
21ConnectApi.MentionSegmentInput mentionSegmentInput = new ConnectApi.MentionSegmentInput();
22ConnectApi.MessageBodyInput messageBodyInput = new ConnectApi.MessageBodyInput();
23ConnectApi.TextSegmentInput textSegmentInput = new ConnectApi.TextSegmentInput();
24
25messageBodyInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();
26
27textSegmentInput.text = 'Does anyone in this group have an idea? ';
28messageBodyInput.messageSegments.add(textSegmentInput);
29
30mentionSegmentInput.id = '0F9D00000000oOT';
31messageBodyInput.messageSegments.add(mentionSegmentInput);
32
33commentInput.body = messageBodyInput;
34
35ConnectApi.Comment commentRep = ConnectApi.ChatterFeeds.postCommentToFeedElement(communityId, feedElementId, commentInput, null);