-
Notifications
You must be signed in to change notification settings - Fork 60
Get-PartnerInvoiceLineItem gives no Error Message #202
Description
The idea was to get the files and invoices provided through CSP via an API which I wanted to code. The problem here is that I get some but not all files and sometimes not even an errormessage.
Steps to reproduce
Connect-PartnerCenter
$path = "C:\tmp"
$d = Get-PartnerInvoice
$d | ForEach-Object {$ivid = $.InvoiceId
$pathname = $path + $.InvoiceDate.Year + "" + $.InvoiceDate.Year + "" + $_.InvoiceDate.Month
$pathname2 = $pathname + "" + $ivid + " - Azure - Billing" + ".xlsx"
$pathname2
start-sleep 5
Get-PartnerInvoiceStatement -InvoiceId $ivid -OutputPath $pathname -Overwrite
Get-PartnerInvoiceLineItem -BillingProvider Azure -InvoiceId $ivid -LineItemType BillingLineItems -CurrencyCode 'Euro' | Export-Excel $pathname2
$pathname2 = $pathname + "" + $ivid + " - Azure - Usage" + ".xlsx"
$pathname2
start-sleep 5
Get-PartnerInvoiceLineItem -BillingProvider Azure -InvoiceId $ivid -LineItemType UsageLineItems -CurrencyCode 'Euro' | Export-Excel $pathname2
$pathname2 = $pathname + "" + $ivid + " - Office - Billing" + ".xlsx"
$pathname2
start-sleep 5
Get-PartnerInvoiceLineItem -BillingProvider Office -InvoiceId $ivid -LineItemType BillingLineItems -CurrencyCode 'Euro' | Export-Excel $pathname2
$pathname2 = $pathname + "" + $ivid + " - Office - Usage" + ".xlsx"
$pathname2
start-sleep 5
Get-PartnerInvoiceLineItem -BillingProvider Office -InvoiceId $ivid -LineItemType UsageLineItems -CurrencyCode 'Euro' | Export-Excel $pathname2
$pathname2 = $pathname + "" + $ivid + " - OneTime - Billing" + ".xlsx"
$pathname2
start-sleep 5
Get-PartnerInvoiceLineItem -BillingProvider OneTime -InvoiceId $ivid -LineItemType BillingLineItems -CurrencyCode 'Euro' | Export-Excel $pathname2
$pathname2 = $pathname + "" + $ivid + " - OneTime - Usage" + ".xlsx"
$pathname2
start-sleep 5
Get-PartnerInvoiceLineItem -BillingProvider OneTime -InvoiceId $ivid -LineItemType UsageLineItems -CurrencyCode 'Euro' | Export-Excel $pathname2
$pathname2 = $pathname + "" + $ivid + " - Marketplace - Billing" + ".xlsx"
$pathname2
start-sleep 5
Get-PartnerInvoiceLineItem -BillingProvider Marketplace -InvoiceId $ivid -LineItemType BillingLineItems -CurrencyCode 'Euro' | Export-Excel $pathname2
$pathname2 = $pathname + "" + $ivid + " - Marketplace - Usage" + ".xlsx"
$pathname2
start-sleep 5
Get-PartnerInvoiceLineItem -BillingProvider Marketplace -InvoiceId $ivid -LineItemType UsageLineItems -CurrencyCode 'Euro' | Export-Excel $pathname2
Write-Host "-----------------"
start-sleep 5
}
Expected behavior
To get the files / data I needed
Actual behavior
It gives me errors that the 'Invoice Line Item type is not valid.' which is okay for me. But sometimes I get the following:
Get-PartnerInvoiceLineItem :
as you can see it states no error at all or even what's wrong with it. It doesn't matter if it is 'Office', 'OneTime' or something else, I get it on several statements with both (BillingLineItems and UsageLineItems). (The start-sleep-statements were added for debugging reasons and should not be the problem I think)
Environment
Script 2.0.1909.5 PartnerCenter {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserRoleMember, Connect-PartnerCenter, Disconnect-PartnerCenter...}
Help is highly appreciated.
Best regards