Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Justin Lasher 2 posts 23 karma points
    Mar 16, 2015 @ 18:52
    Justin Lasher
    0

    Facebook Fan Page

    Let me start by saying thank you for the package! 

    It was very easy to hookup to my profile but I need a clients fan page and pull posts in from that. Is this possible?

    Thanks!
    Justin

  • Justin Lasher 2 posts 23 karma points
    Mar 16, 2015 @ 20:27
    Justin Lasher
    1

    I was able to figure it out. Here's my code, what do you think?

    @using Skybrud.Social.Facebook
    @using Skybrud.Social.Facebook.Objects
    @using Skybrud.Social.Facebook.Responses
    @using Skybrud.Social.Umbraco.Facebook.PropertyEditors.OAuth
    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    @{
        // Get the OAuth information stored in the property
        FacebookOAuthData facebook = Model.GetPropertyValue("facebook") as FacebookOAuthData;
    
        // Check whether the OAuth data is valid
        if (facebook != null && facebook.IsValid)
        {
    
            var service = facebook.GetService();
    
            var posts = service.Posts.GetPosts("clientFanPageAlias");
            <ul>
                @foreach(var item in posts.Body.Data.Where(p => p.Type.In("photo","video","link")).Take(5))
                {
                    <li>@item.Message</li>
                }
            </ul>
        }
    }
    
  • Anders Bjerner 487 posts 2996 karma points MVP 8x admin c-trib
    Mar 16, 2015 @ 23:56
    Anders Bjerner
    0

    Hi Justin,

    I haven't tested your code, but it looks correctly. For pages you can simply specify the alias of the page - exactly as you have done ;)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies