2

类似于这个问题Getting public URL to file in Google Drive using .NET API

使用 Google.APIs.Drive.v2 API 我可以列出文件DriveService.Files.List()。这将返回一个文件集合。

这些项目有一个属性exportLinks,但是该属性对于我的所有文件都是空的。

请指教。谢谢。

注意:文件所在的文件夹使用 Visible with Link 共享。

更新:根据克劳迪奥的要求添加一个结果条目:

   {
  "kind": "drive#file",
    "id": "0B3huP1kT5Jg7ckIwM1JFODhqQnM",
    "etag": "\"-tJAWr_lbRQU2o8gZ0X7BCBIlVk/MTM0MTA3MDYwODUxOQ\"",
    "selfLink": "https://www.googleapis.com/drive/v2/files/0B3huP1kT5Jg7ckIwM1JFODhqQnM",
    "alternateLink": "https://docs.google.com/file/d/0B3huP1kT5Jg7ckIwM1JFODhqQnM/edit",
    "thumbnailLink": "https://lh4.googleusercontent.com/DLv5EK327dWfKyE4OHVvqmtPNAJBh564NHWoMo_xNzjdsG9cyYgYPpca3K5VdmHfqQ=s220",
    "permissionsLink": "https://www.googleapis.com/drive/v2/files/0B3huP1kT5Jg7ckIwM1JFODhqQnM/permissions",
    "title": "WILDCHIL-BLAVEC-FULL-001.png",
    "mimeType": "image/png",
    "labels": {
     "starred": false,
     "hidden": false,
     "trashed": false,
     "restricted": false,
     "viewed": false
    },
    "createdDate": "2012-06-30T15:36:48.519Z",
    "modifiedDate": "2012-06-30T15:36:48.519Z",
    "modifiedByMeDate": "2012-06-30T15:36:46.095Z",
    "parents": [
     {
      "kind": "drive#parentReference",
      "id": "0B3huP1kT5Jg7MjNfMHZLcEdVbHM",
      "selfLink": "https://www.googleapis.com/drive/v2/files/0B3huP1kT5Jg7ckIwM1JFODhqQnM/parents/0B3huP1kT5Jg7MjNfMHZLcEdVbHM",
      "parentLink": "https://www.googleapis.com/drive/v2/files/0B3huP1kT5Jg7MjNfMHZLcEdVbHM",
      "isRoot": false
     }
    ],
    "downloadUrl": "https://doc-10-94-docs.googleusercontent.com/docs/securesc/aarkh960uprlp23t4c9u2f081smlqd2o/noa9bibpnrmajuo2632hl6ocidpf1q0j/1342476000000/03524686860055462013/03524686860055462013/0B3huP1kT5Jg7ckIwM1JFODhqQnM?h=16653014193614665626&e=download&gd=true",
    "userPermission": {
     "kind": "drive#permission",
     "etag": "\"-tJAWr_lbRQU2o8gZ0X7BCBIlVk/9STkNeCmz61YXorH3hoJimnEgfM\"",
     "id": "current",
     "role": "owner",
     "type": "user"
    },
    "originalFilename": "WILDCHIL-BLAVEC-FULL-001.png",
    "fileExtension": "png",
    "md5Checksum": "ebfa9523688cc5e0aee4cce74c288819",
    "fileSize": "701686",
    "quotaBytesUsed": "701686",
    "ownerNames": [
     "Swcatalog-canada"
    ],
    "lastModifyingUserName": "Swcatalog-canada",
    "editable": true,
    "writersCanShare": true
   },
4

2 回答 2

1

并非所有文件格式都支持 exportLinks,png 就是其中之一。要了解所有可能的导入/导出组合,请请求关于提要并检查importFormatsexportFormats字段:

https://developers.google.com/drive/v2/reference/about#resource

于 2012-07-17T02:11:43.400 回答
0

如果您在 Google 文档中遇到缺少 exportLinks 的情况,请仔细检查您的权限范围。

于 2015-09-05T07:50:55.377 回答