In previous versions I was able to retrieve the results from a query using:
var facebookClient = new Facebook.FacebookClient(accessToken);
const string fqlQuery = "select pic_big from user where uid=me()";
dynamic result = facebookClient.Query(fqlQuery);
var profilePhotoUrl = result[0].pic_big.ToString();
In version 6, I can accomplish the same, but using:
var facebookClient = new Facebook.FacebookClient(accessToken);
const string fqlQuery = "select pic_big from user where uid=me()";
dynamic result = facebookClient.Get("fql", new { q = fqlQuery });
var profilePhotoUrl = result.data[0].pic_big.ToString(); //v6.0 requires us to add ".data[0]" field
The new way work, but I just want to make sure that: result.data[0].pic_big.ToString() is correct.
Yes your new call including the data property is correct. I’m not sure about the reason behind the change. Including the data property mimics the JSON structure of the results more accurate, but because I don’t know if the data element was already present or not.
Anyway: using the data property is the way to go from now on!