[英]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.