2012-10-28 155 views
0
var webRequest = (HttpWebRequest)HttpWebRequest.Create("https://graph.facebook.com/"); 
      webRequest.Method = "POST"; 
      webRequest.ContentType = "application/x-www-form-urlencoded"; 

      var requestString = "fql?q=SELECT status_id, message FROM status 
       WHERE uid=me()"; 

      byte[] bytedata = Encoding.UTF8.GetBytes(requestString); 

      webRequest.ContentLength = bytedata.Length; 

      var requestStream = webRequest.GetRequestStream(); 
      requestStream.Write(bytedata, 0, bytedata.Length); 
      requestStream.Close(); 

      var response = webRequest.GetResponse(); 
      var responseStream = new StreamReader(response.GetResponseStream()); 
      var responseString = responseStream.ReadToEnd(); 

我試圖讓狀態消息對我的fb帳戶上面的代碼拋出錯誤的請求,這一次使用Facebook的API get請求說無效的參數FQL Facebook的API查詢

   string accessToken = ViewState["accessToken"].ToString(); 
      Facebook.FacebookClient fb = new FacebookClient(accessToken); 
      dynamic me = fb.Get("/me"); 

      var id = me.id; 

      string query = "SELECT status_id, message FROM status WHERE uid=me()"; 

      var posts = fb.Get("/fql?q=SELECT status_id, message FROM status WHERE uid=me()"); 

任何幫助,將不勝感激.. Facebook的給我headbangings ..:\ 和最後一件事是上面的查詢工作在FQL圖形API模擬器完美

https://developers.facebook.com/tools/explorer?method=GET&path=uridfields%3Did%2Cname

回答

0

我想你正在尋找這個:Facebook Graph API - User
在連接下你會發現「狀態」。

爲了獲得所有狀態的數組,您必須致電/me/statuses?access_token=ACCESS_TOKEN 您必須具有read_stream權限。

希望我能幫上忙。

編輯: 在WinRT中的情況: 我會打電話圖形API以另一種方式(不知道這是否是更好,但它也能工作):

// Example Uri 
Uri requestUri = new Uri("https://graph.facebook.com/me/statuses?access_token=ACCESS_TOKEN");  

HttpClient client = new HttpClient(); 
HttpResponseMessage response = await client.GetAsync(requestUri); 

string content = await response.Content.ReadAsStringAsync(); 
return content;