Google Apps Script cannot convert from GAS managed to specific Cloud Project

馋奶兔 提交于 2020-06-16 16:52:51

问题


I have a GAS managed project which i want to convert to a specific google standard cloud project. I have the ID. I enter it in Resources/Cloud Managed Project and i get :- "Project does not exist or you need edit access to it."

It does exist and i have permissions as I am the owner.


回答1:


The error is somewhat misleading and it took me a while to figure out what was going on, but the issue is that when you're replacing the default "App Script managed" project, if you're not the owner of that project, then you can't delete it and set a new project; so this error message isn't referring to the newly created cloud project, which does exist and which you are the owner of, it's referring to the automatically created apps script managed project.

What this means is that you can only set a new project when you open the script editor on a spreadsheet you're the owner of (I guess).

For me I first realised this when I went to the "File" menu in the script editor to choose "Delete Project" and saw that it didn't exist, even though I was an editor of the original spreadsheet. It wasn't until I was logged in as the owner of that spreadsheet that I could see "Delete project".

Even when I deleted the project, and then went and opened the script editor first from the other file owner, I still didn't have the Delete Project option, and I also still couldn't set the project number.

What I ended up doing was:

Assume A is the original owner of the script, and B is an editor of the script, and also the owner of the new cloud platform project.

1) From the cloud platform project, logged in as B, add A as an owner of the project

2) From the Script editor logged in as A, set the cloud platform project to the project number

3) Configure the oauth consent screen from A

Now the project number has been replaced, the Apps Script managed project is deleted, and account B owns the cloud platform project even though they are not the owner of the script.




回答2:


If the project is in a Shared Google Drive, like a team drive, you are no longer the owner (even if it says you are).

I couldn't create a new project in a shared drive and convert it to a Cloud Managed Project.

The only way I could do it was to create a new project on my account, in My Drive, and convert that to a Cloud Managed Project, THEN move it to the shared drive. (Once it is in a shared drive, you can't MOVE it back out.) However, if it is a Cloud Managed Project, you can add more scopes to the project after it is in the shared drive. - Once this new project is setup, then copy over your code for your old copy, and point all links to the new one.



来源:https://stackoverflow.com/questions/57692530/google-apps-script-cannot-convert-from-gas-managed-to-specific-cloud-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!