user640582
user640582

Reputation: 31

'Facebook.JsonObject' does not contain a definition for 'name' ERROR

I've just installed the facebook c# sdk, but when I'm tring to run the example (after all chenges done in the web.config) I'm receiving this error messgae:

'Facebook.JsonObject' does not contain a definition for 'name' 

the code is:

Line 31:         var fb = new FacebookClient(this.CurrentSession.AccessToken);

Line 32:         dynamic myInfo = fb.Get("me");

Line 33:         lblName.Text = myInfo.name;

Line 34:         pnlHello.Visible = true;

the error is in line 33.

What I am doing wrong ?

I've found the sulotion:

line 33 should be -> lblName.Text = myInfo["name"];

Upvotes: 2

Views: 1367

Answers (1)

Alex
Alex

Reputation: 1171

Got the reason:

  • You probably added Newtonsoft.Json to the Project.
  • Reason: Adding the whole library Folder to the Project will show up unsatisfied dependencies to it (because of the JsonNetSerializer.cs file) - you do not want to add this to the project either.

Upvotes: 3

Related Questions