Example #1
0
        public static IEnumerable <FacebookPost> GetLastestFacebookPosts(object OAuthValue)
        {
            // Get the OAuth information stored in the property
            FacebookOAuthData facebook = OAuthValue as FacebookOAuthData;

            // Check whether the OAuth data is valid
            if (facebook != null && facebook.IsValid)
            {
                // Gets an instance of FacebookService based on the OAuth data
                FacebookService service = facebook.GetService();

                // Get information about the authenticated user
                FacebookUser me = service.Users.GetUser("me").Body;

                // Gets the most recent posts of the authenticated user (me)
                FacebookPostsResponse response = service.Posts.GetPosts(new FacebookGetPostsOptions
                {
                    Identifier = "me",
                    Fields     = "id,name,message,story,created_time,picture,link,description,status_type,type,likes",
                    Limit      = 25
                });

                return(response.Body.Data.ToList());
            }
            return(null);
        }
 /// <summary>
 /// Gets the posts by the specified user or page.
 /// </summary>
 /// <param name="identifier">The identifier of the user/page.</param>
 /// <param name="limit">The maximum amount of posts to return.</param>
 public FacebookPostsResponse GetPosts(string identifier, int limit = 0)
 {
     return(FacebookPostsResponse.ParseJson(Raw.GetPosts(identifier, limit)));
 }
Example #3
0
 /// <summary>
 /// Gets the posts by the specified user or page.
 /// </summary>
 /// <param name="name">The name of the user/page.</param>
 /// <param name="limit">The maximum amount of posts to return.</param>
 public FacebookPostsResponse GetPosts(string name, int limit = 0)
 {
     return(FacebookPostsResponse.ParseJson(Raw.GetPhotos(name, limit)));
 }
Example #4
0
 /// <summary>
 /// Gets the posts by the specified user or page.
 /// </summary>
 /// <param name="id">The ID of the user/page.</param>
 /// <param name="limit">The maximum amount of posts to return.</param>
 public FacebookPostsResponse GetPosts(long id, int limit = 0)
 {
     return(FacebookPostsResponse.ParseJson(Raw.GetPhotos(id + "", limit)));
 }
Example #5
0
 /// <summary>
 /// Gets a list of posts of the user or page with the specified <code>identifier</code>.
 /// </summary>
 /// <param name="identifier">The identifier (ID or name) of the page or user.</param>
 /// <param name="options">The options for the call to the API.</param>
 public FacebookPostsResponse GetPosts(string identifier, FacebookPostsOptions options)
 {
     return(FacebookPostsResponse.ParseResponse(Raw.GetPosts(identifier, options)));
 }