13
votes

I have a google site with a form.I have added a script to the form's spreadsheet and added a "on form submit" trigger. I am trying to create an empty circle.

Here is the script.

function createCircle(e) {

try{
  var email  = Session.getActiveUser().getEmail();
  var sh = SpreadsheetApp.getActiveSheet();
  var circle = PlusDomains.newCircle();
  circle.displayName = e.values[1];
  var userId = 'me';
  circle = PlusDomains.Circles.insert(circle, userId);
  MailApp.sendEmail(email,'event created' , "Circle name is ");
  }catch(e){
    var email  = Session.getActiveUser().getEmail();
    MailApp.sendEmail(email,'event failed' , e.message);
  }

}

I have activated the Google+ Domains API for the script by going to Resources->Advanced Google Services. There is a line that says These services must also be enabled in the Google Developers Console. So I went into the Developers console and activated the API.

I still get the same error, Access Not Configured. Please use Google Developers Console to activate the API for your project.

2
Did you also activate the Google+ API and Drive API in the developers console? - abraham
I did. I left this yesterday and am back at it today. This error is gone but new error, "Forbidden" - nupac
That likely means that the credentials you are using are expired or invalid. - abraham
do you mean the credentials of the user currently logged in? - nupac
I am getting the same response. Been Googling for HOURS. Did you manage to work this one out? - nickspiel

2 Answers

0
votes

You are using PlusDomains.Circles.insert. Make sure your site is created under your paid Google Apps account, PlusDomains will only work with Google Domains (i.e. paid accounts). Just a thought

6
votes

It's exactly what it says. To fix:

  1. Goto Google Developers Console on https://console.developers.google.com
  2. Choose your project from the list
  3. Select API's from the left nav
  4. Turn ON the API you are trying to access.

You may need to regenerate your access and refresh token for this to work.