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 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
add comment

2 Answers 2

I've been trying to find information about when this was added, but this now works as you'd expect.

When I create (or modify) a calendar event, I can start typing the name of a contact and I'll get a drop down menu that includes their address(es).

share|improve this answer
add comment

I wrote a small snippet that does the trick.

Code

function CalendarEvents() {
  // get contact 
  var contactByMail = ContactsApp
    .getContactsByEmailAddress('e-mail with address in Google Contacts');

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

  // set date
  var date = new Date("September 26, 2013");

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

Usage

This code will run just from within the script. There's no need to add it to a Google Spreadsheet. Go to script.google.com while you're logged in. Add the code and press the bug button to authenticate the script. Afterwards, press the play button to execute the script.

References

See the ContactsApp and the CalendarApp from Google Apps Script.

  1. CalendarApp
  2. ContactsApp
share|improve this answer
    
Asking as a newbie: How exactly can I use this? Where do I have to paste the code? –  David Sep 25 '13 at 20:21
    
@David Moin, see my revised answer. Thanks for your feedback !! –  Jacob Jan Tuinstra Sep 26 '13 at 7:15
    
When I try to debug the script I get the following Error: TypeError: Cannot call method "getAddresses" of undefined. (line 7, file "Code") What do I miss? –  David Sep 30 '13 at 10:11
    
@David have you added an address of the e-mail contact? –  Jacob Jan Tuinstra Sep 30 '13 at 10:25
    
Ah! No, I didn't. I have tried it out a little bit now... So I actually have to open the script every time I want to add an event? –  David Sep 30 '13 at 11:52
show 4 more comments

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.