Closed WJurecki closed 5 years ago
hey @WJurecki - This was actually brought up in an issue a while ago, and it appears that the difference between the .NET SDK when leaving the default value for Fields
(or even wide open as *
) on a request vs specifying a subset of Fields is negligible: https://github.com/scrthq/PSGSuite/issues/63#issuecomment-401243201
I'm adding it in, but forewarning that it doesn't add a performance gain as you'd expect. Here is my testing after adding, you can see that getting a subset of fields performs roughly the same as getting all of them.
Note that the previous setup was defaulting to 'files,kind,nextPageToken'
, so I've retained that as the default value for the parameter.
Hey @WJurecki - v2.26.2 is out now with Fields support for Get-GSDriveFileList
. Please try it out and let me know if you're having any issues! Thanks for your patience!
Hi @scrthq, thanks for adding the -Fields option.
It appears these is an issue with a logic of this new feature.
When executing Get-GSDriveFileList
without the -Fields
option the returned objects are different in version 2.26.2 than it was in 2.26.1. This is because $request.Fields
is only set when -Fields
is specified and therefore never being set with the default of 'files,kind,nextPageToken'
and results in the google default field set.
This further shows that the issue with Get-GSDriveFileList limits pagesize to 100 #175 must be a vendor limit of the returned result size because when specifying only a few fields pagesize works up to 1,000.
Good catch @WJurecki ! See my note here on that PR where that code bit changed. Very accurate analysis.
Checking out the difference in behavior now and will get it resolved asap if impacting!
Confirmed the difference, getting a fix out in a few minutes 💪 thanks again!
Fixed and deployed in v2.26.4!
I would like to be able to specify what fields to have returned to increate performance.
For example I know that in my code I am only ever going to use the
parents
,name
,id
, andfolderColorRgb
properties of the objects returned and therefore would like to increase performance by not having the remaining properties collected and returned.I would like a
-Fields
parameter added that accepts property names.Such as:
Get-GSDriveFileList -Fields 'parents,name,id,folderColorRgb'
orGet-GSDriveFileList -Fields 'parents','name','id','folderColorRgb'
This example would result in the value assigned to
$request.Fields
at line 116 beingfiles(parents,name,id,folderColorRgb),kind,nextPageToken
API Explorer confirms this is the proper format for the
$request.Fields
For compatibility with existing behavior you could simply have this new
-Fields
parameter default to*
sincefiles(*),kind,nextPageToken
is a valid request that returns the current result set.Performance Tips discusses this and shows proper formatting.