2016-06-11 62 views
-1

我想上传文件到Google Drive文件夹,如果文件名相同,我想跳过。使用下面的代码,我可以将文件上传到Google云端硬盘。但如何获取文件夹内的文件名?Google API REST获取FilesInFolder名称

File newFile = GoogleDriveHelper.uploadFile(service, dir, directoryId); 

我指的是谷歌REST document当我通过在所有的帕拉姆,它会在谷歌驱动器返回的ID。

Thx for Advice!

回答

1

检查here将fileId传递给此函数。 fileId可以在here

public static void printFile(DriveService service,String fileId) 
     { 
      try 
      { 
       File file = service.Files.Get(fileId).Execute(); 
       Console.WriteLine("Title: " + file.Title); 

      } 
      catch (Exception e) 
      { 
       Console.WriteLine("An error occurred: " + e.Message); 
      } 
     } 
+0

thx Mike。这行得通 – Yeep