SCRT-HQ / PSGSuite

Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
https://psgsuite.io/
Apache License 2.0
234 stars 66 forks source link

Get-GSDriveFileList status code #244

Open dshleg opened 4 years ago

dshleg commented 4 years ago

Is your feature request related to a problem? Please describe. Get-GSDriveFileList periodically returns zero data

Describe the solution you'd like Method returns status code about request

scrthq commented 4 years ago

Hey @xnext40 - Thank you for opening this up! Do you have any more info around if/how you're able to replicate it, how often it recurs, and what exactly you see when you get the status code as the response? I'm not able to replicate on my end and haven't seen this yet, so any additional insight would be extremely helpful! Also, any environment specifics like OS, PowerShell version, PSGSuite version, etc would be good to have as well.

dshleg commented 4 years ago

Hi, script works on Windows Server 2016 with native PS version 5.1.14409.1005 and Windows 2012 R2 with updated version up to 5.1.14409.1005. PSGSuite version 2.33.2 I try checking file or folder exist by command: $GSFileList = Get-GSDriveFileList -ParentFolderId $ParentID -Filter "name = '$($Path[$Position])'","trashed = 'False'" then i check if($GSFileList.length -gt 0) and by result create new folder $Folder = New-GSDriveFile -Name $Path[$Position] -Parents $ParentID -MimeType DriveFolder Periodically i see folder duplicates. I trying to repeat this situation but unable to simulate( extremly random bug ), maybe you helps to simulate..... there is a suspicion that perhaps this is due to processor loading or server connection error.

I have idea about behavior if function finds folder folder then return result and status 200(as example) or if not found return 200 with empty result, but if result empty and status not equal 200 = error