Open AndersRask opened 5 years ago
Hi!
Thank for your reporting this. Unfortuately I cannot fix this, as this is out of the scope of PnP PowerShell. The Get-PnPTenantSite cmdlet is the PnP equivalent of the Get-SPOSite cmdlet in the Office 365 Management Shell and we have feature parity with that cmdlet. We use both the same backend code to execute the request, and also Get-SPOSite has an issue with that specific filter. The filter is added to a request and then sent off to the server, which executes the request with the filter. In this case it's the server not being able to parse the filter.
We're investigating what's happening server side with this filter but not guarantees (as we have no control over the server side code) if this will be fixed.
As temporary work around, consider modifying your filter to
Get-PnPTenantSite -Filter "Url -like 'leg*legacy368'"
The workaround will require string replacement, as it is generated on-the-fly. Can you confirm if multiple wildcards are allowed? (eg replace all instances of '-' with '*'
@erwinvanhunen unfortunately wildcards cannot be used the way you mention.
From my tests I find that wildcards only works as a pre- or suffix, not in the middle of the string:
Also, as soon as you start adding wildcards, you must either add complete url or always prefix with *, as only filter on Url (not alias/title) seems to be supported!
get-pnptenantsite : Filtering is not supported for property Title.
Get-PnPTenantSite -Filter "Url -like 'leg*legacy368'"
Get-PnPTenantSite -Filter "Url -like 'leglegacy368'"
Get-PnPTenantSite -Filter "Url -like 'leglegacy368*'"
Only way I found to match was to drop the prefix name completely:
Get-PnPTenantSite -Filter "Url -like '*legacy368'"
So far this works for me, as the naming is unique, but for less strict naming conventions this would not be optimal
Reporting an Issue or Missing Feature
Issue when calling
Get-PnPTenantSite -Filter "Url -like 'leg-legacy368'"
Expected behavior
All sites matching the filter
Actual behavior
The problem is the '-le' in the filter component 'leg-legacy368' is interpreted as a join operator (-le) The same problem can be observed for -eq, -ne, -like, -notlike:
Steps to reproduce behavior
Type any of the following commands
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
3.5.1901.0 SharePointPnPPowerShellOnline
How did you install the PnP-PowerShell Cmdlets?