如何使用C#中的Chatter SalesForce WSDL服务检索FeedComment

时间:2011-08-13 05:48:25

标签: c# asp.net wsdl salesforce salesforce-chatter

我必须检索salesforce chatter的新闻Feed我能够获得主要状态但无法检索评论。在c#中是否有使用SalesForce chatter WSDL API获取注释的示例?

2 个答案:

答案 0 :(得分:3)

您可以使用子关系查询从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);
}

答案 1 :(得分:2)

这将为您提供NewsFeed +评论+喜欢:

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