Display list of files ( more than 100 records ) from Google Drive using Google Drive API in ASP.Net

Last Reply one year ago By aruna

Posted one year ago


I can able get the files from Google Drive using API thru the reference of this link.

But I got 100 records only. I ve some thousands of records. Can anyone please let me know what to change to get the full records display

Posted one year ago Modified on one year ago

Thru the below code, I can able to fetch 1000 records.

namespace gDrive
    class Program
        static string[] Scopes = { DriveService.Scope.DriveReadonly };
        static string ApplicationName = "Drive API .NET Quickstart";

    static void Main(string[] args)
        UserCredential credential;
        gDriveTableAdapter gDrive = new gDriveTableAdapter();

        using (var stream =
            new FileStream("client_secret.json", FileMode.Open, FileAccess.Read))
            string credPath = System.Environment.GetFolderPath(
            credPath = Path.Combine(credPath, ".credentials/drive-dotnet-quickstart.json");

            credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                new FileDataStore(credPath, true)).Result;
            //Console.WriteLine("Credential file saved to: " + credPath);

        // Create Drive API service.
        var service = new DriveService(new BaseClientService.Initializer()
            HttpClientInitializer = credential,
            ApplicationName = ApplicationName,

        // Define parameters of request.
        FilesResource.ListRequest listRequest = service.Files.List();
        listRequest.PageSize = 1000;
        listRequest.Fields = "nextPageToken, files(webViewLink, name)";

        // List files.
        IList<Google.Apis.Drive.v3.Data.File> files = listRequest.Execute()
        if (files != null && files.Count > 0)
            foreach (var file in files)
                gDrive.InsertQuery(file.Name, file.WebViewLink);
            Console.WriteLine(files.Count + " records fetched.");
            Console.WriteLine("No files found.");



I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html