2011-08-13 30 views

回答

3

您可以使用子关系查询从NewsFeed遍历到子FeedComments。这里有一个SOQL查询,返回两个主体地位和评论给定用户的一个例子:

SELECT Id, Body, (Select Id, CommentBody FROM FeedComments) FROM NewsFeed WHERE ParentId = '00560000000wX0aAAE' 

不知道关于C#具体,但它可能会返回FeedComments为嵌套数组。下面是顶点遍历结果的一个例子:

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); 
} 
+0

我已经看到了这一点,有一个在C#中没有FeedComment类..这就是为什么我问问题的原因? – Brij

+1

您使用企业版还是合作伙伴WSDL?我刚刚检查了Enterprise WSDL 22.0,并且FeedComment在那里(假设您在导出时启用了Chatter)。另一方面,合作伙伴WSDL不会有具​​体的类,并且会动态访问。 – ryanbrainard

+0

我使用了合作伙伴WSDL,这就是为什么课程不在那里。 – Brij

2

这将让你的新闻源+评论+喜欢:

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 
+0

有没有什么办法让FeedComments像salesforce一样 –

相关问题