2012-11-26 13 views
5

Sto provando a sviluppare un'app con C# sul desktop in cui un utente sta cercando una persona tramite e-mail o nome. Quindi elencherà gli utenti con le informazioni dell'utente e gli album o le immagini pubbliche. Quindi l'utente del programma guarderà alle foto se riesce a trovare la persona giusta per la ricerca aggiungerà un amico.Album pubblico Facebook

Il mio problema è che non posso elencare e mostrare album pubblici. Ho provato con FQL e graph API, ma entrambi hanno restituito dati nulli. Il codice che ho scritto per questo:

ArrayList pictureLink; 
public void userPhotos(string userID) 
     { 
      var fb2 = new FacebookClient(_accessToken); 

//result1 and result2 aren't using in code only for looking for with breakpoint 
      dynamic result1 = fb2.Get("fql", new { q = "SELECT aid,cover_pid FROM album WHERE owner=" + kisiID }); 
      dynamic result2 = fb2.Get("fql", new { q = "SELECT pid,aid FROM photo WHERE owner=" + kisiID }); 

      ArrayList imageSize; //for gettig highest pixell of picture 
      pictureLink = new ArrayList(); 
      var fb = new FacebookClient(_accessToken); 

      //dynamic albums = fb.Get("me/albums"); // THİS code is rigth runnig 
     dynamic albums = fb.Get(userID + "/albums"); 

      foreach (dynamic albumInfo in albums.data) 
      { 
       //Get the Pictures inside the album this gives JASON objects list that has photo attributes 
       // described here http://developers.facebook.com/docs/reference/api/photo/ 
       dynamic albumsPhotos = fb.Get(albumInfo.id + "/photos"); 
       foreach (dynamic rs in albumsPhotos.data) 
       { 
        imageSize= new ArrayList(); 
        foreach (dynamic rsa in rs.images) 
        { 
         imageSize.Add(rsa.height); 
        } 
        int highestImage = Convert.ToInt32(imageSize[0]); 
        foreach (dynamic rsa in rs.images) 
        { 
         if (rsa.height == highestImage) 
         { 
          string link= rsa.source; 
          pictureLink.Add(link); 
         } 
        } 
       } 
     }    
} 

risposta

0

Per leggere un album è necessario:

  • Qualsiasi token di accesso valido se è pubblica e appartiene a una pagina
  • Il permesso user_photos se appartiene ad un utente
  • Il permesso friend_photos se appartiene ad un amico dell'utente

Fonte: https://developers.facebook.com/docs/reference/api/album/

Quello che vi serve sarebbe la seguente dichiarazione, che è non nella lista.

  • Qualsiasi token di accesso valido se è pubblico e appartiene a un utente

Ciò significa che l'API semplicemente non ti consente di accedere a album pubblici. È lo stesso con events.

Problemi correlati