Add-PeppolInvoiceAttachment

EulandaXtools — Funktionsreferenz

Add-PeppolInvoiceAttachment

ÜBERSICHT

Fügt einer Peppol-UBL-Rechnung ein oder mehrere Attachments als EmbeddedDocumentBinaryObject hinzu.

SYNTAX

Add-PeppolInvoiceAttachment [-UblXml] <xml> [-UblPath] <string> [-AttachmentPath] <string[]>
    [[-DocumentType] <string>] [[-FileName] <string>] [[-MimeType] <string>] [[-OutputPath]
    <string>]

BESCHREIBUNG

Ergänzt eine bestehende Peppol BIS Billing 3.0 / UBL 2.1 Invoice um eingebettete Attachments (Base64 in cac:AdditionalDocumentReference / cac:Attachment / cbc:EmbeddedDocumentBinaryObject).

Wichtig:

PARAMETER

-UblXml

Type: xml

UBL-Invoice als [xml]-Objekt.

-UblPath

Type: string

Pfad zu einer bestehenden UBL-Datei.

-AttachmentPath

Type: string[]

Pfad zu einer oder mehreren Dateien, die eingebettet werden sollen.

-DocumentType

Type: string
Default: 'Invoice PDF'

Beschreibung des Attachments (wird als cbc:DocumentDescription geschrieben), z. B. "Invoice PDF".

-FileName

Type: string

Optionaler Dateiname für das Attachment (Attribut "filename" am EmbeddedDocumentBinaryObject). Bei mehreren Attachments wird bei Bedarf automatisch ein Suffix angehängt, damit der Dateiname eindeutig bleibt.

-MimeType

Type: string
Default: 'application/pdf'

MIME-Type des Attachments. Standard: application/pdf

-OutputPath

Type: string

Optionaler Pfad zum Speichern der modifizierten UBL.

AUSGABEN

System.Xml.XmlDocument

BEISPIELE

# UBL aus Datei laden, PDF einbetten und Ergebnis speichern
Add-PeppolInvoiceAttachment -UblPath 'C:\Temp\invoice.xml' -AttachmentPath 'C:\Temp\invoice.pdf' -OutputPath 'C:\Temp\invoice.with-attachment.xml'
# Bereits geladenes XML-Objekt erweitern und als XML zurückgeben
$ubl = [xml](Get-Content -Raw -Path 'C:\Temp\invoice.xml')
$result = Add-PeppolInvoiceAttachment -UblXml $ubl -AttachmentPath 'C:\Temp\invoice.pdf'
$result.OuterXml | Out-File -Encoding utf8 'C:\Temp\invoice.with-attachment.xml'
# Mehrere Attachments einbetten (Dateinamen werden bei Bedarf automatisch eindeutig gemacht)
Add-PeppolInvoiceAttachment -UblPath 'C:\Temp\invoice.xml' -AttachmentPath @('C:\Temp\a.pdf','C:\Temp\b.pdf') -DocumentType 'Arbeitsnachweis' -MimeType 'application/pdf'