When I request a list of files using google.api.drive, I return a single pdf file "How to get started with Drive"

I need to get a list of files from google drive with asp.net mvc4 project. Google Drive is used as file storage for the site. My code is:

        const string email = "xxx";
        string path = AppDomain.CurrentDomain.BaseDirectory + "file.p12";
        var certificate = new X509Certificate2(path,"notasecret", X509KeyStorageFlags.Exportable);
        var credential = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(email){
            Scopes = new[] { DriveService.Scope.Drive }

        }.FromCertificate(certificate));
        var service = new DriveService(new BaseClientService.Initializer
        {
            HttpClientInitializer = credential,
            ApplicationName="hikes"
        });
        List<File> result = new List<File>();
        FilesResource.ListRequest request = service.Files.List();
        do
        { 
                FileList files = request.Execute();
                result.AddRange(files.Items);
                request.PageToken = files.NextPageToken;

        } while (!String.IsNullOrEmpty(request.PageToken));

I tried two different accounts. The result is only one PDF file called "How to get started with Drive." How to access files on my disk?

+4
source share
1 answer

Google , Google (416132713247-aimfq7... hj37795pcpvo3@developer.gserviceaccount.com): > s > email .

+6

All Articles