Yisal Khan
Yisal Khan

Reputation: 387

Failed to get the driveId in the callback of the google picker in shared drive

I am trying to get the shared drive id in the callback of the google picker. The response I am getting is attached in screenshotenter image description here

These are the scopes for getting the drive data These are the scopes for getting the drive data

Following is the code for creating picker

let view = new google.picker.DocsView()
            .setOwnedByMe(false)
            .setParent(vm.folderLocationId)
            .setEnableDrives(true)
            .setMimeTypes('application/vnd.google-apps.folder')
            .setSelectFolderEnabled(true);

const picker = new google.picker.PickerBuilder()
          .enableFeature(google.picker.Feature.NAV_HIDDEN)
          .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
          .enableFeature(google.picker.Feature.SUPPORT_DRIVES)
          .setDeveloperKey(vm.api_key)
          .setAppId(APP_ID)
          .setOAuthToken(vm.access_token)
          .addView(view)
          .addView(new google.picker.DocsUploadView())
          .setCallback(pickerCallback)
          .build();
      picker.setVisible(true);

async function pickerCallback(data) {
  console.log('data', data)
}

This is the response of console.log enter image description here

I am using gapi not google drive api for doing this.

Please let me know what I am doing wrong.

Thanks

Upvotes: 1

Views: 208

Answers (1)

Yisal Khan
Yisal Khan

Reputation: 387

As I was trying to get the drive id by which I can access the folders of the shared drive.

I did it by adding the parameter of supportsAllDrives: true

enter image description here

Upvotes: 1

Related Questions