in src/Modules/Admin/Commands.Admin/GetPowerBIActivityEvent.cs [110:145]
private IList<object> ExecuteCmdletHelper(string formattedStartDateTime, string formattedEndDateTime)
{
var finalResult = new List<object>();
using (var client = this.CreateClient())
{
try
{
ActivityEventResponse response = client.Admin.GetPowerBIActivityEvents(formattedStartDateTime, formattedEndDateTime, null, this.Filter);
while (response.ContinuationToken != null)
{
finalResult.AddRange(response.ActivityEventEntities);
string formattedContinuationToken = $"'{WebUtility.UrlDecode(response.ContinuationToken)}'";
response = client.Admin.GetPowerBIActivityEvents(null, null, formattedContinuationToken, null);
}
finalResult.AddRange(response.ActivityEventEntities);
}
catch (HttpOperationException ex)
{
var deserialized = JsonConvert.DeserializeObject<PowerBIFeatureNotAvailableErrorType>(ex?.Response?.Content);
if (deserialized != null && deserialized.Error != null && deserialized.Error.Code.Equals(FeatureNotAvailableError))
{
string errorId = "Feature is not available on your tenant.";
var errorRecord = new ErrorRecord(ex, errorId, ErrorCategory.NotEnabled, this /*targetObject*/);
var powerBIRestExceptionRecord = new PowerBIRestExceptionRecord(ex, errorRecord);
this.Logger.ThrowTerminatingError(powerBIRestExceptionRecord, ErrorCategory.NotEnabled);
}
else
{
throw;
}
}
}
return finalResult;
}