简体   繁体   English

是否可以为谷歌驱动器 api v3 C# 中的文件添加自定义元数据?

[英]Is it possible to add custom metadata for a file in google drive api v3 C#?

I have a list of files to be uploaded to Google Drive.我有一个要上传到 Google Drive 的文件列表。

Is it possible to add custom metadata to each file?是否可以向每个文件添加自定义元数据?

Yes, this is possible.是的,这是可能的。

See: https://developers.google.com/drive/api/v3/properties请参阅: https://developers.google.com/drive/api/v3/properties

You can set properties and appProperties on the File object.您可以在File object 上设置propertiesappProperties

"To add properties visible to all apps, use the properties field of files resource. To add properties restricted to your app, use the appProperties field on files resource." “要添加对所有应用程序可见的属性,请使用files资源的properties字段。要添加仅限于您的应用程序的属性,请使用files资源上的appProperties字段。”

Example (assuming you know how to upload the filestream with contenttype, and only want explanation on the metadata):示例(假设您知道如何使用 contenttype 上传文件流,并且只想对元数据进行解释):

var file = new File
{
    Properties = new Dictionary<string, string>
    {
        { "CustomTag", "1234" }
    }
};
service.Files.Create(file, fileStream, contentType).Execute();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Drive V3 Api获取文件名,C# - Google Drive V3 Api get File Name, C# 使用Google Drive API v3 C#将文件从共享的Google驱动器复制到我的Google驱动器 - Make a copy of file from shared google drive to my google drive with Google Drive API v3 C# C# Google Drive Api v3 Uploadprogress 没有火起来 - C# Google Drive Api v3 Uploadprogress not getting fire 谷歌驱动器 api v3 c# 文件上传期间的上传进度触发器 - Google drive api v3 c# Uploadprogress trigger during file Upload C#:如何使用 Google Drive API v3 将文件上传到特定文件夹 - Windows 控制台应用程序 - C# : How to Upload File to a Specific Folder using Google Drive API v3 - Windows Console Application 如何在C#中列出来自Google Drive API V3的1000多条记录 - How to list of more than 1000 records from Google Drive API V3 in C# 使用C#(客户端库v3)对Google Drive API进行单元和集成测试? - Unit and Integration Testing for Google Drive API using C# (Client Library v3)? 如何让 Google Drive API v3 示例在 C# 中工作? - How to get the Google Drive API v3 Samples to work in C#? 如何使用 C# 在 Google Drive v3 API 的特定文件夹中查找文件? - How to find files inside a specific folder in Google Drive v3 API using C#? 列出 id 不是 Google Drive API v3 和 C# 中特定值的目录中的文件夹 - List folders from a directory which id is not a specific value in Google Drive API v3 and C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM