我正在使用Google Drive API获取文件列表,除了name,MimeType,id和Kind之外,我将大部分值视为null。我究竟做错了什么? 我真的在寻找modifiedTime和lastModifyingUser,并将此添加到请求但它不起作用
listRequest.Fields = "files(lastModifyingUser,modifiedTime)"
以下是我正在使用的代码
<pre>
FilesResource.ListRequest listRequest1 = service.Files.List();
listRequest1.PageSize = 100;
listRequest1.Q = "'" + file.Id + "' " + "in parents";
listRequest.OrderBy = "'modifiedDate desc'";
</pre>
它带来了很多文件。以下是文件中的一个
<pre>
{Google.Apis.Drive.v3.Data.File}
AppProperties: null
Capabilities: null
ContentHints: null
CreatedTime: null
CreatedTimeRaw: null
Description: null
ETag: null
ExplicitlyTrashed: null
FileExtension: null
FolderColorRgb: null
FullFileExtension: null
HeadRevisionId: null
IconLink: null
Id: "0B1VioX_6dSXKZ2R2bDdKZDVuTjQ"
ImageMediaMetadata: null
IsAppAuthorized: null
Kind: "drive#file"
LastModifyingUser: null
Md5Checksum: null
MimeType: "application/vnd.google-apps.folder"
ModifiedByMeTime: null
ModifiedByMeTimeRaw: null
ModifiedTime: null
ModifiedTimeRaw: null
Name: "Quarterly VC PowerPoint"
OriginalFilename: null
OwnedByMe: null
Owners: null
Parents: null
Permissions: null
Properties: null
QuotaBytesUsed: null
Shared: null
SharedWithMeTime: null
SharedWithMeTimeRaw: null
SharingUser: null
Size: null
Spaces: null
Starred: null
ThumbnailLink: null
Trashed: null
Version: null
VideoMediaMetadata: null
ViewedByMe: null
ViewedByMeTime: null
ViewedByMeTimeRaw: null
ViewersCanCopyContent: null
WebContentLink: null
WebViewLink: null
WritersCanShare: null
</pre>
答案 0 :(得分:0)
尝试# Prepare the body of the file.
body = File.read(@app_file_name_full)
body = ERB.new(body).result(binding) # Bind to the @instance variables in this module.
# Parse with LESS.
begin
body = Less::Parser.new({
paths: [@assets_path, "/usr/local/share/gems/gems/twitter-bootstrap-rails-3.2.2/vendor/toolkit/"],
filename: @final_file_name,
compress: true
}).parse(body).to_css
rescue Exception => err
puts "LESS PARSING FAILED! ", err.message
body = nil
end
答案 1 :(得分:0)
我正在使用以下代码:
Google.Apis.Drive.v3.FilesResource.ListRequest listRequest = Dservice.Files.List();
listRequest.Q = "'root' in parents";
listRequest.Fields= @"files(*)";
var files = listRequest.Execute();
google_sheet_files.Clear();
foreach (Google.Apis.Drive.v3.Data.File file in files.Files)
{
if (file.MimeType == "application/vnd.google-apps.spreadsheet")
google_sheet_files.Add(new googlesheet(file.Id, file.Name, file.ModifiedTime ?? DateTime.Now, file.LastModifyingUser.EmailAddress,file.ModifiedByMeTime ?? DateTime.Now));
}