Problem-while getting contact list from gmail

2008-01-28
2013-04-03
  • rama prasad
    rama prasad
    2008-01-28

    Hi I am getting following error and contact list lengh is coming zero.

    This is the output I got.

    -----Logged in.
    Jan 28, 2008 3:09:59 PM siuying.gm.GMConnector getContact
    INFO: Request gmail for contact at url: https://mail.google.com/mail??view=cl&search=contacts&pnl=d&zx=417760014
    - Going to buffer response body of large or unknown size. Using getResponseAsStream instead is recommended.
    **************************************************
    Gmail contacts length for Prasad-->0
    **********************end****************************
    connection is created.

    The code i used was:
    --------------------
    import siuying.gm.GMConnector;
    import siuying.gm.GMConstants;
    import siuying.gm.structure.GMContact;

    import java.util.TimeZone;
    public class samplegmail {

    /**
    * @param args
    */
    public static void main(String[] args) {

        try{
        GMConnector gm; 
        gm = null;
        GMContact[] gmailContacts = null;
        try { 
            gm = new GMConnector(); 
            gm.setUser("rama.prasad81"); 
            gm.setPasswd("gmailtest"); 
            gm.setTimezone(TimeZone.getTimeZone("GMT-8").getID());
           
        } catch (NumberFormatException nfe) { 
                System.exit(1); 
        }          
            if (gm.connect()) { 
                System.out.println("-----Logged in.");
                gmailContacts = gm.getContact(GMConstants.GM_CONTACT_FREQ_MAILED , "");
               
                System.out.println("Gmail contacts length for Prasad-->"+gmailContacts.length);
                /*for(int i=0; i < 10 ;i++){
    System.out.println("Name--->"+gmailContacts[i].getName()+"--Email-->"+gmailContacts[i].getEmail());
                }*/
               
                } else { 
                System.out.println("Failed logging in!"); 
                System.exit(1); 
            } 
            
            boolean i;
            i=gm.isConnected();
            if(i)
            System.out.println("connection is created"); 
            else
            System.out.println("connection failed"); 
        
        }
        catch(Exception erro) { 
        erro.printStackTrace(); 
        }
        
        }
    }

     
    • Saissi
      Saissi
      2008-04-02

      Hi,
      Sorry but i have exactly the same problem? did anybody find the way it should be done? the "getContact" method seems to not work..

       
    • Hi, I am also getting problem while importing Gmail Contacts. I am able to login to gmail but contacts are not getting imported.