protected override string GetCsvReportItemFormated(ReportOutputItem reportOutputItem) { if (reportOutputItem.GetType() != typeof(CustomerUsageReportOutputItem)) { throw new ArgumentException("Report Output Item must be of type CustomerUsageReportOutputItem"); } CustomerUsageReportOutputItem customerUsageReportOutputItem = reportOutputItem as CustomerUsageReportOutputItem; StringBuilder result = new StringBuilder(); result.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}", customerUsageReportOutputItem.Customer.Id, customerUsageReportOutputItem.Customer.CompanyProfile.TenantId, customerUsageReportOutputItem.Customer.CompanyProfile.CompanyName, customerUsageReportOutputItem.OnMicrosoftDomain, customerUsageReportOutputItem.DefaultDomain, customerUsageReportOutputItem.SubscriptionId, customerUsageReportOutputItem.SubscriptionStatus, customerUsageReportOutputItem.SubscriptionQuantity, customerUsageReportOutputItem.OfferName, customerUsageReportOutputItem.SKUPartNumber, customerUsageReportOutputItem.SKUTotalServices, customerUsageReportOutputItem.SKUService, customerUsageReportOutputItem.SKUServiceProvisioningStatus, customerUsageReportOutputItem.SKUAssignedSeats.ToString(), customerUsageReportOutputItem.SKUServiceActiveUsers.ToString(), customerUsageReportOutputItem.GlobalActionType, customerUsageReportOutputItem.GlobalActionSubType); return(result.ToString()); }
protected override string GetCsvReportItemFormated(ReportOutputItem reportOutputItem) { if (reportOutputItem.GetType() != typeof(ActivationReportOutputItem)) { throw new ArgumentException("Report Output Item must be of type Activation Report."); } ActivationReportOutputItem activationReportOutputItem = reportOutputItem as ActivationReportOutputItem; StringBuilder result = new StringBuilder(); // For reference // return "CustomerId\tTenantId\tCompanyName\tOnMicrosoftDomain\tDefaultDomain\tTotalDomains\t" + //"TotalSKUs\tOfferName\tSKUPartNumber\tSKUCapabilityStatus\tTotalSKUSubscriptions\tEarliestSKUSubscription\t" + //"ActiveSeats\tInGracePeriodSeats\tDisabledSeats\tAssignedSeats\t" + //"ActionType\tActionSubType"; if (activationReportOutputItem.CustomerSubscribedSkuAndSubscriptions.Count == 0) { // No subscribed Skus. Output at global level result.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}\t{17}\n", // Customer / Company info ####### activationReportOutputItem.Customer.Id, activationReportOutputItem.Customer.CompanyProfile.TenantId, activationReportOutputItem.Customer.CompanyProfile.CompanyName ?? string.Empty, // Domains info ####### // On Microsoft Domain (Initial domain) activationReportOutputItem.CustomerDomains.Count > 0 ? activationReportOutputItem.CustomerDomains .FirstOrDefault(domain => domain.IsInitial && domain.IsVerified).Name : string.Empty, // Default domain activationReportOutputItem.CustomerDomains.Count > 0 ? activationReportOutputItem.CustomerDomains .FirstOrDefault(domain => domain.IsDefault && domain.IsVerified).Name : string.Empty, // Total domains activationReportOutputItem.CustomerDomains.Count(), string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, activationReportOutputItem.GlobalActionType ?? string.Empty, activationReportOutputItem.GlobalActionSubType ?? string.Empty); } else { foreach (ActivationReportSubscribedSKUOutputItem subscribedSku in activationReportOutputItem.CustomerSubscribedSkuAndSubscriptions) { result.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}\t{17}\n", // Customer / Company info ####### activationReportOutputItem.Customer.Id, activationReportOutputItem.Customer.CompanyProfile.TenantId, activationReportOutputItem.Customer.CompanyProfile.CompanyName ?? string.Empty, // Domains info ####### // On Microsoft Domain (Initial domain) activationReportOutputItem.CustomerDomains.Count > 0 ? activationReportOutputItem.CustomerDomains .FirstOrDefault(domain => domain.IsInitial && domain.IsVerified).Name : string.Empty, // Default domain activationReportOutputItem.CustomerDomains.Count > 0 ? activationReportOutputItem.CustomerDomains .FirstOrDefault(domain => domain.IsDefault && domain.IsVerified).Name : string.Empty, // Total domains activationReportOutputItem.CustomerDomains.Count(), // Subscribed Skus info ####### // Total SKUs activationReportOutputItem.CustomerSubscribedSkuAndSubscriptions.Count(), // Sku Offer Name subscribedSku.Offer != null ? subscribedSku.Offer.Name : string.Empty, // Sku Part Number subscribedSku.SubscribedSKU.SkuPartNumber ?? string.Empty, // Sku Capability Status subscribedSku.SubscribedSKU.CapabilityStatus ?? string.Empty, // Total Sku Subscriptions subscribedSku.SKUSubscriptions.Count(), // Earliest Sku Subscription subscribedSku.SKUSubscriptions.Count > 0 ? subscribedSku.SKUSubscriptions.OrderBy(subscription => subscription.CreationDate).FirstOrDefault().CreationDate.ToShortDateString() : string.Empty, // Active and In Grace Period Seats subscribedSku.ActiveSeats, subscribedSku.InGracePeriodSeats, // Disabled and Assigned Seats subscribedSku.DisabledSeats, subscribedSku.AssignedSeats, // Action Type subscribedSku.ActionType ?? string.Empty, // Action Subtype subscribedSku.ActionSubType ?? string.Empty); } } // Remove last new line result = result.Remove(result.Length - 1, 1); return(result.ToString()); }