Google api Google API REST获取文件信息文件夹名称

Google api Google API REST获取文件信息文件夹名称,google-api,google-drive-api,Google Api,Google Drive Api,我想上传一个文件到谷歌驱动器文件夹,如果文件名相同,我想跳过。通过下面的代码,我可以将文件上传到谷歌硬盘。但是如何在文件夹中获取文件名呢 File newFile = GoogleDriveHelper.uploadFile(service, dir, directoryId); 我指的是GoogleREST,当我传入所有参数时,它将返回GoogleDrive中的Id 谢谢你的建议 选中将文件ID传递给此函数。文件ID可以在以下位置获取: 选中“将文件ID传递给此函数”。文件ID可以在以下位置

我想上传一个文件到谷歌驱动器文件夹,如果文件名相同,我想跳过。通过下面的代码,我可以将文件上传到谷歌硬盘。但是如何在文件夹中获取文件名呢

File newFile = GoogleDriveHelper.uploadFile(service, dir, directoryId);
我指的是GoogleREST,当我传入所有参数时,它将返回GoogleDrive中的Id

谢谢你的建议

选中将文件ID传递给此函数。文件ID可以在以下位置获取:

选中“将文件ID传递给此函数”。文件ID可以在以下位置获取:

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);
            }
        }