diff --git a/PSGSuite/Public/Docs/New-GSDocument.ps1 b/PSGSuite/Public/Docs/New-GSDocument.ps1 index 51c17bb7..2c6450be 100644 --- a/PSGSuite/Public/Docs/New-GSDocument.ps1 +++ b/PSGSuite/Public/Docs/New-GSDocument.ps1 @@ -26,7 +26,7 @@ function New-GSDocument { ( [parameter(Mandatory = $false,ValueFromPipeline = $true,Position = 0)] [String] - $Title = "Untitled document", + $Title, [parameter(Mandatory = $false)] [Alias('Owner','PrimaryEmail','UserKey','Mail')] [string] @@ -54,6 +54,9 @@ function New-GSDocument { try { $body = New-Object 'Google.Apis.Docs.v1.Data.Document' $body.Title = $Title + if (!$Title) { + $Title = "Untitled document" + } Write-Verbose "Creating Document '$Title' for user '$User'" $request = $service.Documents.Create($body) $response = $request.Execute() | Add-Member -MemberType NoteProperty -Name 'User' -Value $User -PassThru diff --git a/PSGSuite/Public/Sheets/New-GSSheet.ps1 b/PSGSuite/Public/Sheets/New-GSSheet.ps1 index fe5a3c5f..28539007 100644 --- a/PSGSuite/Public/Sheets/New-GSSheet.ps1 +++ b/PSGSuite/Public/Sheets/New-GSSheet.ps1 @@ -27,7 +27,7 @@ function New-GSSheet { [parameter(Mandatory = $false)] [Alias('SheetTitle')] [String] - $Title = "Untitled spreadsheet", + $Title, [parameter(Mandatory = $false,ValueFromPipelineByPropertyName = $true)] [Alias('Owner','PrimaryEmail','UserKey','Mail')] [string] @@ -55,6 +55,9 @@ function New-GSSheet { $body.Properties = New-Object 'Google.Apis.Sheets.v4.Data.SpreadsheetProperties' -Property @{ Title = $Title } + if (!$Title) { + $Title = "Untitled spreadsheet" + } Write-Verbose "Creating Spreadsheet '$Title' for user '$User'" $request = $service.Spreadsheets.Create($body) $response = $request.Execute() | Add-Member -MemberType NoteProperty -Name 'User' -Value $User -PassThru diff --git a/PSGSuite/Public/Slides/New-GSPresentation.ps1 b/PSGSuite/Public/Slides/New-GSPresentation.ps1 index 52684d9b..d225f151 100644 --- a/PSGSuite/Public/Slides/New-GSPresentation.ps1 +++ b/PSGSuite/Public/Slides/New-GSPresentation.ps1 @@ -26,7 +26,7 @@ function New-GSPresentation { ( [parameter(Mandatory = $false,ValueFromPipeline = $true,Position = 0)] [String] - $Title = "Untitled presentation", + $Title, [parameter(Mandatory = $false)] [Alias('Owner','PrimaryEmail','UserKey','Mail')] [string] @@ -54,6 +54,9 @@ function New-GSPresentation { try { $body = New-Object 'Google.Apis.Slides.v1.Data.Presentation' $body.Title = $Title + if (!$Title) { + $Title = "Untitled presentation" + } Write-Verbose "Creating Presentation '$Title' for user '$User'" $request = $service.Presentations.Create($body) $response = $request.Execute() | Add-Member -MemberType NoteProperty -Name 'User' -Value $User -PassThru