I am trying to set some custom file properties to some files that I am uploading to google drive using the API. I am doing this in dot net using C#. I saw a sample code in the net as follows:

{
  'key':        'additionalID',
  'value':      '8e8aceg2af2ge72e78',
  'visibility': 'PRIVATE'
}

But this code is giving me compile error (Syntax error at ":"). My code is below:

string myMimeType = GetMimeType(FileName);
System.IO.FileInfo info = new System.IO.FileInfo(FileName);
Google.Apis.Drive.v2.Data.File body = new Google.Apis.Drive.v2.Data.File();
     body.Title = info.Name;
     body.Description = info.Name;
     body.MimeType = myMimeType;
     body.Editable = false;
     body.Shared = true;
     body.Properties = new List<PropertyList>() {
                "key": "myspecialID",
                "value": "test123456",
                "visibility": "PUBLIC" };

Thanks.

没有正确的解决方案

其他提示

By looking at the V2 API for File and Property it looks more like this is how you would add properties to File objects. The structure you saw on this page was just a psuedo outline of the properties.

body.Properties = new IList<Property>() {
    new Property() { Key = "myspecialID", Value = "test123456", Visibility = "PUBLIC" }
};
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top