[英]Getting posts (poster name, photo, text body) into VF page from specific Chatter group - Struggling getting into VF
我正在处理一些在Internet上找到的代码-我只上过ADM 201课程。
我正在做的是尝试从帖子中提取信息,然后将其放入VF页面。 我知道我可以使用chatter:feed,但这可以获取所有信息和功能,而我只需要文本正文,海报名称和图片(不是必需的)。
到目前为止,我有:
顶点类:
public class Test_3 { //Class is
public ConnectApi.FeedElementPage feedElementPage{get;set;}
public Test_3() {
feedElementPage = ConnectApi.ChatterFeeds.getFeedElementsFromFeed('0F958000000TWvL', ConnectApi.FeedType.Record, 'showInternalOnly');
}
}
VF页面:
<apex:page controller="Test_5">
<div class="posts">
<div class="row">
<div class="col-md-6">
<apex:repeat value="{!feed.elements}" var="feedElement">
<div class="media">
<a class="pull-left" href="{!feedElement.parent.id}">
<img class="media-object" src="{!feedElement.photoUrl}" alt="{!feedElement.actor.name}"/>
</a>
<div class="media-body">
<h4 class="media-heading">{!feedItem.actor.name}</h4>
// This creates a heading from the posts that is the poster's name
{!feedElement.body.text}
// This is the body of the post
</div>
</div>
</apex:repeat>
</div>
</div>
</div>
<footer>
<p>© Operations Updates - Please refresh your browser for the latest</p>
</footer>
</apex:page>
当前的问题:
无论如何,我无法解决。 我一直在努力使它变得可爱5个小时。
任何帮助将非常感激。
从这里修改了代码,然后我尝试将其更新为Items中的Elements。
谢谢
在Apex类中,变量称为“ feedElementPage”,但在Visualforce页面中,变量为“ feed”。 请更新feedElementPage
到feed
中的Apex类或更新repeat value="{!feed.elements}"
来repeat value="{!feedElementPage.elements}"
另外,我认为您应该使用FeedItem而不是FeedElement 。 请查看该文档,如果还有其他问题,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.