Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Say I have 5 contacts in a group. I would like to see all their details in one page (/view), preferably separated by an horizontal line between every contact.

Is something like this possible?

share|improve this question
    
Can you give me some feedback, whether my answer was sufficient? –  Jacob Jan Tuinstra Jan 25 '13 at 20:34
add comment

2 Answers

The following Google Apps Script will enable you to select a particular group (available in your contacts) and present all contacts. The data shown, only contains the full name and e-mail addresses (if available). You can add other data if you wish (yourself...):

function doGet(e) {
  var app = UiApp.createApplication().setTitle('Group Contacts');

  // create grid
  var mFlex = app.createFlexTable().setId('mFlex').setStyleAttribute('borderCollapse','collapse');

  // create label for title
  mFlex.setWidget(0, 0, app.createLabel('Display Contacts per Group').setStyleAttribute('fontWeight', 'bold'));

  // retrieve group names
  var gNames = ContactsApp.getContactGroups();

  // create listbox to hold group names
  mFlex.setWidget(1, 0, app.createListBox().setId('lBox').setName('lBox')
    .addChangeHandler(app.createServerHandler('getContacts').addCallbackElement(app.getElementById('lBox'))));

  // add groups to listbox
  app.getElementById('lBox').addItem('Select Contact Group ...');
  for(var i in gNames) {
    app.getElementById('lBox').addItem(gNames[i].getName());
  } 

  // set first item in lBox
  app.getElementById('lBox').setItemSelected(0, true);

  // all to app
  app.add(mFlex);

  //return to appliccation
  return app; 
}

function getContacts(e) {
  // get active application
  var app = UiApp.getActiveApplication();

  // create panel
  var fTable = app.createFlexTable().setId('fTable');
  var vPanel = app.createVerticalPanel().setId('vPanel').setWidth(500);
  var sPanel = app.createScrollPanel().setId('sPanel').setHeight(300).setWidth(520);

   // get group name
  var gName = ContactsApp.getContactGroup(e.parameter.lBox);

  // get group contacts
  var gContacts = ContactsApp.getContactsByGroup(gName);

  // itterate through contacts 
  if(gContacts.length == 0) {
    fTable.setWidget(0, 0, app.createLabel('No contacts available'));
  } else { 
    // add headers
     app.getElementById('fTable').setWidget(0, 0, app.createLabel('Full name')
       .setStyleAttribute('fontWeight', 'bold'));
     app.getElementById('fTable').setWidget(0, 1, app.createLabel('e-mail address')
       .setStyleAttribute('fontWeight', 'bold'));

    // add data to fTable    
    for(var i=0, len=gContacts.length; i<len; i++) {
      if(gContacts[i].getFullName() == null) {
        app.getElementById('fTable').setWidget(parseInt(i)+1, 0, app.createLabel('No name').setWidth(200)
          .setStyleAttribute('borderBottom','1px solid #e1e1e1'));
      } else {
        app.getElementById('fTable').setWidget(parseInt(i)+1, 0, app.createLabel(gContacts[i].getFullName()).setWidth(200)
          .setStyleAttribute('borderBottom','1px solid #e1e1e1'));
      }
      if(gContacts[i].getEmails().length == 0) {
        app.getElementById('fTable').setWidget(parseInt(i)+1, 1, app.createLabel('No e-mail address').setWidth(200)
          .setStyleAttribute('borderBottom','1px solid #e1e1e1'));
      } else {        
        app.getElementById('fTable').setWidget(parseInt(i)+1, 1, app.createLabel(gContacts[i].getEmails()[0].getAddress())
        .setWidth(300).setStyleAttribute('borderBottom','1px solid #e1e1e1'));    
      }
    }
  }

  // add widgets
  app.getElementById('mFlex').setWidget(2, 0, sPanel.add(vPanel.add(fTable)));

  //return to application
  return app;
}

Upon install, press the bug to gain authorization:

enter image description here


Here's how it looks like in action:

contacts per group

share|improve this answer
    
When I try to deploy the code at script.google.com I get an error: "Authorization is required to perform that action". –  eyalev Feb 28 '13 at 8:28
    
@eyalev see revised answer. –  Jacob Jan Tuinstra Mar 1 '13 at 7:09
add comment

Google official does not has any such feature at all, but you can always create an internet-bot for such things.

You can view the details of the contacts (email address, cell phone number, address) one by one.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.