如何在c#中使用Chatter SalesForce WSDL服务检索FeedComment
本文关键字:WSDL SalesForce 服务 检索 FeedComment Chatter | 更新日期: 2023-09-27 18:05:33
我必须检索salesforce chatter的新闻提要,我能够获得主要状态,但无法检索评论。有没有在c#中使用SalesForce chatter WSDL API获得注释的示例?
您可以使用子关系查询从NewsFeed遍历到子FeedComments。下面是一个SOQL查询示例,它返回给定用户的主状态和注释:
SELECT Id, Body, (Select Id, CommentBody FROM FeedComments) FROM NewsFeed WHERE ParentId = '00560000000wX0aAAE'
不确定c#的具体情况,但它可能会将FeedComments作为嵌套数组返回。下面是在Apex中迭代结果的示例:
NewsFeed nf = [SELECT Id, Body, (Select Id, CommentBody FROM FeedComments) FROM NewsFeed WHERE ParentId = '00560000000wX0aAAE'];
System.debug(nf.Id);
System.debug(nf.Body);
for (FeedComment fc : nf.FeedComments) {
System.debug(fc.Id);
System.debug(fc.CommentBody);
}
这将为您提供新闻提要+评论+喜欢:
SELECT Id, Type,
CreatedById, CreatedBy.FirstName, CreatedBy.LastName,
ParentId, Parent.Name,
Body, Title, LinkUrl, ContentData, ContentFileName,
(SELECT Id, FieldName, OldValue, NewValue
FROM FeedTrackedChanges ORDER BY Id DESC),
(SELECT Id, CommentBody, CreatedDate,
CreatedBy.FirstName, CreatedBy.LastName
FROM FeedComments ORDER BY CreatedDate LIMIT 10),
(SELECT CreatedBy.FirstName, CreatedBy.LastName
FROM FeedLikes)
FROM NewsFeed
ORDER BY CreatedDate DESC, Id DESC
LIMIT 100