Blank Variable

Hi Team.

Hoping someone might be able to help get around a small issue. 

I have a Workflow that has a Parameter of Location. Values assigned to that are for example Server1 , Server2  , Server3 , Server4

Now when you run the Work flow and select Server2 , 3 , or 4 it adds this value to the $Location variable and connects accordingly. The Issue is that when people select Server1 i actually dont want anything passed in to the variable and for it to be blank. As an example if i was to hard code these it would be something like

https://DomainName-admin.sharepoint.com

https://DomainNameServer2-admin.sharepoint.com 

https://DomainNameServer3-admin.sharepoint.com 

https://DomainNameServer4-admin.sharepoint.com 

Any suggestions on how to work around this? 

$Location = $Workflow.Parameter("Location")

#Connection Propertis
$SPURL = "https://DomainName$Location-admin.sharepoint.com"
$ClientID = "something something"
$TenantName = "DomainName.onmicrosoft.com"
$Thumbprint = "something something"

#CSV Export Location
$CSVExport = "C:\$Location-Export.csv"


#Connect to SharePoint Online
Connect-PnPOnline -Url $SPURL -ClientId $ClientID -Tenant $TenantName -Thumbprint $Thumbprint

Parents Reply
  • Hi. 

    I got around it using this method. 

    $Location = $Workflow.Parameter("Location")
    
    switch ($Location) {
        'server1' { $SPURL = 'https://DomainName-admin.sharepoint.com' }
        default   { $SPURL = "https://DomainName$Location-admin.sharepoint.com"}
    }
    
    #Connection Properties
    $CxParams = @{
        URL        = $SPURL
        ClientID   = "something something"
        Tenant     = "DomainName.onmicrosoft.com"
        Thumbprint = "something something"
    }
    
    #CSV Export Location
    $CSVExport = "C:\$Location-Export.csv"
    
    #Connect to SharePoint Online
    Connect-PnPOnline @CxParams

Children
No Data