[英]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 上设置properties
和appProperties
。
"To add properties visible to all apps, use the
properties
field offiles
resource. To add properties restricted to your app, use theappProperties
field onfiles
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.