即使经过过滤,Google Picker 也会显示指向不属于我的文件的快捷方式 AFAIK,目前不可能功能请求解决方法

问题描述

我正在使用驱动器 Picker Api 并在网页中制作驱动器选择器。我只显示用户拥有的驱动器文件或项目(相当于使用查询作为 owner="me")。

现在我在选择器中遇到一个问题:它还显示用户不是所指向文件的所有者的文件或项目的快捷方式。

我需要显示用户拥有的文件。要么通过一种方式来过滤所有快捷方式,要么理想情况下仅包含用户是所有者的文件或项目的快捷方式。

这是所有者文件选择器的示例代码。

//The API developer key obtained from the Google Cloud Console.
var developerKey = "{developerkey value}";

// The Client ID obtained from the Google Cloud Console.
var clientId = "{clientId value}";

// Scope to use to access user's Drive.
var scope = [
  "https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/userinfo.email",];

var pickerApiLoaded = false;
var oauthToken;

// Use the API Loader script to load google.picker and gapi.auth

function onApiLoad() {
  gapi.load("auth",{ callback: onAuthApiLoad });
  gapi.load("picker",{ callback: onPickerApiLoad });
}

function onAuthApiLoad() {
  window.gapi.auth.authorize(
    {
      client_id: clientId,scope: scope,immediate: false,},handleAuthResult
  );
}

function onPickerApiLoad() {
  pickerApiLoaded = true;
  createPicker();
}

function handleAuthResult(authResult) {
  if (authResult && !authResult.error) {
    oauthToken = authResult.access_token;
    createPicker();
  }
}
// Create and render a Picker object.
function createPicker() {
  var DocsView = new google.picker.DocsView(
    google.picker.ViewId.DOCS
  ).setOwnedByMe(true);
  var picker = new google.picker.PickerBuilder()
    .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
    .enableFeature(google.picker.Feature.SUPPORT_DRIVES)
    .addView(DocsView)
    .addView(new google.picker.DocsUploadView())
    .setDeveloperKey(developerKey)
    .setOAuthToken(oauthToken)
    .setCallback(pickerCallback)
    .build();
  picker.setVisible(true);
}

你能帮我吗?如何在 Picker 中排除快捷方式或显示用户是其所有者的快捷方式。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)