Tell me more ×
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 an event that takes place at one of my contact's, I'd like to add this contact to the "where" field of the event, so that e.g. Google Maps can display the appropriate address. Is this possible?

Note: The contact doesn't use Google apps at all, so adding him/her as a participant of the meeting is not an option.

share|improve this question
As opposed to putting their address you mean? – Eight Days of Malaise Mar 3 '11 at 1:02
Well, actually what I want is their address (because that's the place), but the rational for specifying the contact would be "I'm at X's place). The calendar could use X's address, then. – jhwist Mar 3 '11 at 7:01
@jhwist: did you find my answer useful? Please give feedback if you need assistance with the implementation. – Jacob Jan Tuinstra Dec 22 '12 at 0:15

1 Answer

See the ContactsApp and the CalendarApp from Google Apps Script.

  1. CalendarApp
  2. ContactsApp

Create new Event, Retrieve Contact (getContactsByName), Retrieve address, setLocation

EDIT: wrote a small snippet that does the trick:

function CalendarEvents() {
  // create application
  var app = UiApp.createApplication();

  // get contact 
  var contactByMail = ContactsApp.getContactsByEmailAddress('an e-mail');

  // get location
  var location = contactByMail[0].getAddresses()[0].getAddress();

  // set date
  var date = new Date("November 22, 2012");

  // fetch calendar
  var cal = CalendarApp.getCalendarById('your e-mail')
    .createAllDayEvent("test", date, {location:location});

  //return to application  
  return app; 
}
share|improve this answer

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.