title: Retrieving files from a shared folder using Drive api V3,
body: <p>I have read/write permissions to a shared folder with another Google user.</p>
  
  <p>I want to list all the files (in all the folders) in that shared folder link using drive V3 API.</p>
  
  <p>What is the best way to do this?
  The solution currently employed is pretty slow in performance if the number of folders inside shared folders is large.</p>
  
  <p>My Current solution:</p>
  
  <p>1 - Finding all the folders in shared link</p>
  
  <p>2 - Finding all files whose parent is folder</p>
  
  <pre><code>private void getFolderHierarchy(File Res, DriveService driveService, string localPath, string editorName, string projectName)
  {
      if (Res.MimeType == "application/vnd.google-apps.folder")
      {
          m_parent += Res.Name + @"\";
  
          foreach (var res in ResourceFromFolder(driveService, Res.Id).ToList())
              getFolderHierarchy(res, driveService, localPath, editorName, projectName);
  
          m_parent = m_parent.Remove(m_parent.Length - Res.Name.Length - 1);
      }
      else if (Res.MimeType == "image/jpeg" || Res.MimeType == "image/png")
      {
          {
              if (!m_DownloadedFromEditorFileId.Contains(Res.Id))
              {           
                  m_DownloadedGoogleFileId.Add(Res.Name);
                  m_parent = m_parent.Remove(m_parent.Length - Res.Name.Length);
              }
          }
      }
  }
  
  public List&lt;File&gt; ResourceFromFolder(DriveService service, string folderId)
  {
      var request = service.Files.List();
      request.PageSize = 100;
      request.Q = "'" + folderId + "'" + " in parents and trashed=false";
      request.Fields = "files(modifiedTime,id,parents,name,webContentLink,mimeType)";
  
      List&lt;File&gt; TList = new List&lt;File&gt;();
      do
      {
          var children = request.Execute();
  
          foreach (var child in children.Files)
          {
              System.Threading.Thread.Sleep(10);
              TList.Add(service.Files.Get(child.Id).Execute());
          }
          request.PageToken = children.NextPageToken;
      } while (!String.IsNullOrEmpty(request.PageToken));
  
      return TList;
  }
  </code></pre>