Skip to content

Commit

Permalink
Merge pull request #11 from Thomas-Edvardsson/shared-drive-search-wit…
Browse files Browse the repository at this point in the history
…h-AllDriveItems-parameter

Added parameter "AllDriveItems"
  • Loading branch information
MVKozlov authored Feb 17, 2021
2 parents 45c86f5 + fa8ebd4 commit e293c35
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions GMGoogleDrive/Public/Find-GDriveItem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Search GoogleDriver for items with specified Query
.PARAMETER Query
Search Query
.PARAMETER AllDriveItems
Get result from all drives (inluding shared drives)
.PARAMETER AllResults
Collect all results in one output
.PARAMETER OrderBy
Expand All @@ -19,6 +21,8 @@
Find-GDriveItem -AccessToken $access_token -Query 'name contains "test"'
.EXAMPLE
Find-GDriveItem -AccessToken $access_token -Query 'name contains "test"' -AllResults
.EXAMPLE
Find-GDriveItem -AccessToken $access_token -Query 'name contains "shareddrivetest"' -AllResults -AllDriveItems
.OUTPUTS
Json search result with items metadata as PSObject
.NOTES
Expand All @@ -34,6 +38,9 @@ param(
[Parameter(Position=0)]
[string]$Query,

[parameter(Mandatory=$false)]
[switch]$AllDriveItems,

[Parameter(ParameterSetName='All')]
[switch]$AllResults,

Expand All @@ -54,6 +61,7 @@ param(

[Parameter(Mandatory)]
[string]$AccessToken

)

$Headers = @{
Expand All @@ -62,6 +70,9 @@ param(
Write-Verbose "URI: $GDriveUri"
$Params = New-Object System.Collections.ArrayList
[void]$Params.Add('pageSize=' + $PageSize)
if ($AllDriveItems) {
[void]$Params.Add('includeItemsFromAllDrives=true')
}
if ($Query) {
[void]$Params.Add('q=' + $Query)
}
Expand Down

0 comments on commit e293c35

Please sign in to comment.