beano
beano

Reputation: 952

No item with the given ID could be found, or you do not have permission to access it

I have an add-on which requires access to various Google services, and requests the following access when initially loaded:

enter image description here

I also have a webapp which runs as me (the same google account as the add-on) and can be accessed by anyone including anonymous. The webapp trys to access a form which I believe I should already have access to.

Webapp:

function doGet(){
  var form = FormApp.openById('');
  var formId = form.getId();
  var items = form.getItems();
  return ContentService.createTextOutput("Form contains "+items.length+"items.");
}

Error:

No item with the given ID could be found, or you do not have permission to access it.

Question:

When the add-on initially requests access to the user's Drive, does this give access to the add-on only or to the developers google account?

Upvotes: 3

Views: 22078

Answers (2)

Wicket
Wicket

Reputation: 38296

The error occurs because on the following line:

var form = FormApp.openById('');

The openById parameter is ''. It will be solved by passing the form ID.

You could get the form ID from the URL or by using getId().

Related Q&A

Upvotes: 1

deepGrave
deepGrave

Reputation: 420

I had the same problem, the problem was the ID, in order to fix the problem you need to pass the edit ID of the form. I've attached a picture to further describe. enter image description here

Upvotes: 13

Related Questions