当前位置: 动力学知识库 > 问答 > 编程问答 >

google apps script - I receive "You do not have authorization to perform that action" when accessing Blob contents

问题描述:

I'll skip the details on why, but I have several hundred mbox files stored in Google Drive containing hundreds of thousands of messages that I need to extract the MessageID from. However, I keep getting the following error when I try to access the contents of any of these mbox files:

You do not have authorization to perform that action.

This is in a script that I have already used to gather other information on the files (size, number of files, etc.) and I've already been faced with the standard "This script needs your authorization to run" dialog.

I always seem to get it when I try to get access the Blob as something I can actually use. For example, in my test code below I get the error on fileContents.getDataAsString()

function readContentsTest(){

var file = DriveApp.getFileById('longFileIdStringGoesHere');

var fileContents = file.getAs('application/mbox');

Logger.log(fileContents.getDataAsString());

}

I've tried all sorts of character encoding and various File.getAs types to try and read the contents of the file, but I always run into that authorization error. I am the owner of the files. Am I missing something?

分享给朋友:
您可能感兴趣的文章:
随机阅读: