Wednesday, May 25, 2011

Posts and Comments Retrieval

This is an example of how to get a list of posts on a users wall and read any comments on those posts. You can also request comments for a specific post.

Imports Branches.FBAPI
...
Dim SI As New SessionInfo("[access_token]"))
Dim Req New Functions.Requests(SI)
For Each P In Req.GetPosts("me")
      TestContext.WriteLine(P.id)
      TestContext.WriteLine(P.from.name)
      TestContext.WriteLine(P.message)
      TestContext.WriteLine(P.link)
      TestContext.WriteLine(P.comments.count)
      'Return comments from data on post
      For Each C In P.comments.data
            TestContext.WriteLine(C.from.name)
            TestContext.WriteLine("Comment: " & C.message)
      Next
      'Return comments for a specific postID
      Dim C2 = Req.GetComments(P.id)
      For Each C In C2
            TestContext.WriteLine(C.from.name)
            TestContext.WriteLine("Comment: " & C.message)
      Next
Next

The above emaple is based on unit testing code

No comments:

Post a Comment