Add_ReferencedFileVBA

Methode (Function) · gibt Boolean zurück

Add_ReferencedFileVBA ist eine Methode der Klasse Aloaha_ZUGFeRD.XML im Aloaha ZUGFeRD SDK.

Beschreibung (Originaltext der englischen SDK-Dokumentation): VBA/COM friendly variant of Add_ReferencedFile using an Integer reference type: embeds a file as referenced document of a line item. The file is read, Base64 encoded and stored with file name and name. The MIME type is always looked up from the Windows registry by file extension. Sets the profile to EXTENDED.

Rückgabe: The result of Add_ReferencedFile (see there). Errors are reported in LastError.

Deklaration

Public Function Add_ReferencedFileVBA(ByVal ReferencedFileType As Integer, ByVal PositionNO As Integer, ByVal FilePath As String, ByVal IssuerAssignedID As String, ByVal URIID As String, ByVal LineID As String, ByVal TypeCode As String, ByVal Name As String, ByVal ReferenceTypeCode As String, ByVal IssueDateTime As String, ByVal Document_DateFormat As String, ByVal MimeType As String) As Boolean

Parameter

NameTypPflichtBeschreibung
ReferencedFileTypeIntegererforderlichType of reference as Integer. 1 = additional referenced document of the line item (the only value that is stored); 0, 2, 3, 4 and 14 are accepted but not stored, other values are treated as 0.
PositionNOIntegererforderlichZero-based index of the line item.
FilePathStringerforderlichFull local path of the file to embed (must contain a backslash and exist).
IssuerAssignedIDStringerforderlichDocument reference assigned by the issuer.
URIIDStringerforderlichURI ID / external location of the document.
LineIDStringerforderlichReferenced line ID.
TypeCodeStringerforderlichDocument type code. Empty defaults to 916 (related document).
NameStringerforderlichDocument name / description. Empty defaults to the file name without extension.
ReferenceTypeCodeStringerforderlichReference type code.
IssueDateTimeStringerforderlichIssue date of the document (YYYYMMDD). If empty, the date format is set to 102.
Document_DateFormatStringerforderlichDate format code, 102 for YYYYMMDD.
MimeTypeStringerforderlichNot used; the MIME type is determined from the registry by file extension.

Aufruf (VB.NET)

Dim alo As New Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, False, "IHR-LIZENZSCHLUESSEL")
Dim ReferencedFileType As Integer = 0
Dim PositionNO As Integer = 0
Dim FilePath As String = ""
Dim IssuerAssignedID As String = ""
Dim URIID As String = ""
Dim LineID As String = ""
Dim TypeCode As String = ""
Dim Name As String = ""
Dim ReferenceTypeCode As String = ""
Dim IssueDateTime As String = ""
Dim Document_DateFormat As String = ""
Dim MimeType As String = ""
If Not alo.Add_ReferencedFileVBA(ReferencedFileType, PositionNO, FilePath, IssuerAssignedID, URIID, LineID, TypeCode, Name, ReferenceTypeCode, IssueDateTime, Document_DateFormat, MimeType) Then
    Console.WriteLine("Fehler: " & alo.Last_Error)
End If

Aufruf (C#)

var zfStandard = Aloaha_ZUGFeRD.iXML.ZUGFeRDVersion.xInvoice;   // Optional ByRef im Konstruktor: in C# mit ref übergeben
var alo = new Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, false, "IHR-LIZENZSCHLUESSEL", ref zfStandard);
int referencedFileType = 0;
int positionNO = 0;
string filePath = "";
string issuerAssignedID = "";
string uriid = "";
string lineID = "";
string typeCode = "";
string name = "";
string referenceTypeCode = "";
string issueDateTime = "";
string document_DateFormat = "";
string mimeType = "";
if (!alo.Add_ReferencedFileVBA(referencedFileType, positionNO, filePath, issuerAssignedID, uriid, lineID, typeCode, name, referenceTypeCode, issueDateTime, document_DateFormat, mimeType))
{
    Console.WriteLine("Fehler: " + alo.Last_Error);
}

COM-Schnittstelle

Add_ReferencedFileVBA ist Mitglied der Schnittstelle Aloaha_ZUGFeRD.iXML (Position 171 von 343) und damit auch aus VB6, VBA/Access und anderen COM-Clients über CreateObject("Aloaha_ZUGFeRD.XML") aufrufbar. Neue Mitglieder werden immer am Ende von iXML angefügt, damit bestehende COM-Clients unverändert weiterlaufen; nach einem Update die Typbibliothek neu registrieren.

Quelle: XML-Dokumentationskommentare des Aloaha ZUGFeRD SDK (xml.vb). Gleiche Signatur in VB6/VBA über COM. In C# werden ByRef-Parameter mit ref übergeben, VB-Eigenschaften mit Parametern heißen get_…/set_…, optionale Parameter können entfallen.