CoderForHire
CoderForHire

Reputation: 455

FacebookClient.GetTaskAsync Parameters

I am working on a Windows 8 metro prototype app that will post a message to a wall.

I installed the SDK, and so far I have

public MainWindowViewModel()
{
    try
    {
        Action<object> action = handleTask;

        var fb = new FacebookClient(FACEBOOK_ID, FACEBOK_SECRET);

        var task = fb.GetTaskAsync("4");

        task.ContinueWith(action);
    }
    catch (FacebookApiException ex)
    {
        throw ex;
    }
}

private void handleTask(object data)
{
}

The handleTask method gets called, but I can't seem to determine what the type is that's being passed. The data in it appears to be Mark Zuckerberg's FB info (???)

Again, all I need to do is post to a wall. Can anyone point me in the right direction?

Upvotes: 1

Views: 2208

Answers (1)

prabir
prabir

Reputation: 7794

var fb - new FacebookClient();
fb.GetTaskAsync("4")
  .ContinueWith(t=> 
      if(!t.IsFaulted) {
          dynamic result = t.Result;
          var name = result.name;
      }
  );

or change object data to Task<object> in handleTask

[Update]

Posting to wall.

var fb = new FacebookClient("access_token");
fb.PostTaskAsync("me/feed", new {message = "hi"});

Upvotes: 1

Related Questions