public List <GoogleDriveFiles> GetDriveFiles(string parentId)
        {
            DriveService service = GetService();

            // Define parameters of request.
            FilesResource.ListRequest FileListRequest = service.Files.List();

            //listRequest.PageSize = 10;
            //listRequest.PageToken = 10;
            FileListRequest.PageSize = 1000;
            FileListRequest.Fields   = "nextPageToken, files(id, name, size, version, trashed, createdTime,contentHints/thumbnail,thumbnailLink,fileExtension,iconLink,thumbnailLink,webContentLink,webViewLink,mimeType,parents)";

            // List files.
            IList <Google.Apis.Drive.v3.Data.File> files = FileListRequest.Execute().Files;
            List <GoogleDriveFiles> FileList             = new List <GoogleDriveFiles>();

            if (files != null && files.Count > 0)
            {
                foreach (var file in files)
                {
                    if (file.Parents.Contains(parentId))
                    {
                        GoogleDriveFiles File = new GoogleDriveFiles
                        {
                            Id             = file.Id,
                            Name           = file.Name,
                            Size           = file.Size,
                            Version        = file.Version,
                            CreatedTime    = file.CreatedTime,
                            Type           = file.FileExtension,
                            Thumbnail      = file.HasThumbnail,
                            ThumbnailLink  = file.ThumbnailLink,
                            IconLink       = file.IconLink,
                            WebContentLink = file.WebContentLink,
                            WebViewLink    = file.WebViewLink,
                            Parents        = file.Parents,
                            MimeType       = file.MimeType
                        };
                        FileList.Add(File);
                    }
                }
            }
            return(FileList);
        }
        public void MoveFileTo(GoogleDriveFiles files, string parentId)
        {
            DriveService service = GetService();

            var fileId   = files.Id;
            var folderId = parentId;
            // Retrieve the existing parents to remove
            var getRequest = service.Files.Get(fileId);

            getRequest.Fields = "parents";
            var file            = getRequest.Execute();
            var previousParents = String.Join(",", file.Parents);
            // Move the file to the new folder
            var updateRequest = service.Files.Update(new Google.Apis.Drive.v3.Data.File(), fileId);

            updateRequest.Fields        = "id, parents";
            updateRequest.AddParents    = folderId;
            updateRequest.RemoveParents = previousParents;
            file = updateRequest.Execute();
        }