簡體   English   中英

從特定的Chatter組將帖子(海報名稱,照片,正文)獲取到VF頁面-努力進入VF

[英]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>&copy; Operations Updates - Please refresh your browser for the latest</p>
 </footer>
</apex:page>

當前的問題:

  • !feedElement.parent.id
  • !feedItem.actor.name
  • “錯誤:未知屬性'ConnectApi.Feed.elements'”

無論如何,我無法解決。 我一直在努力使它變得可愛5個小時。

任何幫助將非常感激。

這里修改了代碼,然后我嘗試將其更新為Items中的Elements。

謝謝

在Apex類中,變量稱為“ feedElementPage”,但在Visualforce頁面中,變量為“ feed”。 請更新feedElementPagefeed中的Apex類或更新repeat value="{!feed.elements}"repeat value="{!feedElementPage.elements}"

另外,我認為您應該使用FeedItem而不是FeedElement 請查看該文檔,如果還有其他問題,請告訴我。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM