in src/Modules/Workspaces/Commands.Workspaces/GetPowerBIWorkspace.cs [122:181]
public override void ExecuteCmdlet()
{
if (this.Deleted.IsPresent && this.Scope.Equals(PowerBIUserScope.Individual))
{
// You can't view deleted workspaces when scope is Individual
return;
}
if (this.Orphaned.IsPresent && this.Scope.Equals(PowerBIUserScope.Individual))
{
// You can't have orphaned workspaces when scope is Individual as orphaned workspaces are unassigned
return;
}
if (this.Include != null && this.Include.Any() && this.Scope.Equals(PowerBIUserScope.Individual))
{
// You can't use Include/Expand when scope is Individual
return;
}
if (this.All.IsPresent)
{
this.ExecuteCmdletWithAll();
return;
}
if (this.Deleted.IsPresent)
{
this.Filter = string.IsNullOrEmpty(this.Filter) ? DeletedFilterString : $"({this.Filter}) and ({DeletedFilterString})";
}
if (this.Orphaned.IsPresent)
{
this.Filter = string.IsNullOrEmpty(this.Filter) ? OrphanedFilterString : $"({this.Filter}) and ({OrphanedFilterString})";
}
if (this.ParameterSet.Equals(IdParameterSetName))
{
this.Filter = $"tolower(id) eq '{this.Id}'";
}
if (this.ParameterSet.Equals(NameParameterSetName))
{
this.Filter = $"tolower(name) eq '{this.Name.ToLower()}'";
}
if (!string.IsNullOrEmpty(this.Type))
{
var typeFilter = $"type eq '{this.Type}'";
this.Filter = string.IsNullOrEmpty(this.Filter) ? typeFilter : $"({this.Filter}) and ({typeFilter})";
}
if (!string.IsNullOrEmpty(this.User) && this.Scope == PowerBIUserScope.Organization)
{
var userFilter = $"users/any(u: tolower(u/emailAddress) eq '{this.User.ToLower()}')";
this.Filter = string.IsNullOrEmpty(this.Filter) ? userFilter : $"({this.Filter}) and ({userFilter})";
}
this.GetWorkspaces();
}