Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All.
I would like to fetch facebook user feed posts in once iterating through all the pages for the users feed.
Is there any workaround?

What I have tried:

public async Task<ActionResult> FB_GetFeed()
        {

            var access_token = HttpContext.Items["access_token"].ToString();
            if (!string.IsNullOrEmpty(access_token))
            {
                var appsecret_proof = access_token.GenerateAppSecretProof();

                var fb = new FacebookClient(access_token);

                dynamic myFeed = await fb.GetTaskAsync(
                    ("me/feed?fields=id,from {{id, name, picture{{url}} }},story,picture,link,name,description," +
                    "message,type,created_time,likes,comments")
                    .GraphAPICall(appsecret_proof));
                var postList = new List<FacebookPostViewModel>();

                string NextPageURI = string.Empty;

                if (myFeed.paging != null &&
                    myFeed.paging.next != null)
                    NextPageURI = myFeed.paging.next;
                foreach (dynamic post in myFeed.data)
                {
                    postList.Add(DynamicExtension.ToStatic<FacebookPostViewModel>(post));
                }
                
                
                return PartialView(postList);
            }
            else
                throw new HttpException(404, "Missing Access Token");
        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900