【问题标题】:How to retrieve FeedComment using Chatter SalesForce WSDL service in C#如何在 C# 中使用 Chatter SalesForce WSDL 服务检索 FeedComment
【发布时间】:2011-08-13 05:48:25
【问题描述】:

我必须检索 salesforce chatter 的新闻提要我能够获得主要状态但无法检索 cmets。是否有任何示例可以在 c# 中使用 SalesForce chatter WSDL API 获取 cmets?

【问题讨论】:

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


    【解决方案1】:

    您可以使用子关系查询从 NewsFeed 遍历到子 FeedComments。以下是返回给定用户的主要状态和 cmets 的 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);
    }
    

    【讨论】:

    • 我已经看到了,C# 中没有 FeedComment 类,...这就是我问问题的原因?
    • 您使用的是企业还是合作伙伴 WSDL?我刚刚检查了 Enterprise WSDL 22.0,并且 FeedComment 在那里(假设您在导出时启用了 Chatter)。另一方面,合作伙伴 WSDL 没有具体的类,并且可以动态访问。
    • 我使用了合作伙伴 WSDL,这就是为什么类不存在。
    • 您还应该查看 Chatter REST API - wiki.developerforce.com/page/Chatter_API - 这使得使用 Chatter 变得更加容易。
    【解决方案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
    

    【讨论】:

    • 有没有办法像在salesforce中一样获得FeedComments
    猜你喜欢
    • 2012-08-15
    • 2013-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-01
    • 2021-01-13
    相关资源
    最近更新 更多