Solved
Forum Discussion
MarcusH
9 months agoValued Contributor
1) I agree with TheJonG
2) I think the easiest way to do this is is to export the metadata to XML and pick out what you want. You will need to format it to csv but it should have all the member and relationship property names. This code extracts just the metadata to a string variable. I have cobbled this together from some other scripts but I think it should work.
Imports System.IO.Compression
Imports System.Xml
Dim xmlOptions As New XmlExtractOptions
xmlOptions.ExtractAllItems = True
'Extract dimensions
Dim extractDict As New Dictionary(Of XmlExtractItemPk, Boolean)
extractDict.Add(New XmlExtractItemPk(XmlExtractItemType.Dimensions), True)
'Execute the Metadata Extract
Using dbConnFW As DbConnInfo = BRApi.Database.CreateFrameworkDbConnInfo(si)
Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
Dim zipBytes As Byte() = ApplicationZipFileHelper.Extract(dbConnFW, dbConnApp, Nothing, xmlOptions)
' Decompress the zipped bytes into memory
Using zipStream As New MemoryStream(zipBytes)
Using archive As New ZipArchive(zipStream, ZipArchiveMode.Read)
' Iterate through each entry in the zip archive
For Each entry As ZipArchiveEntry In archive.Entries
If entry.fullname.toupper = "METADATA.XML" Then
' Read the contents of the entry into a string
Using entryStream As Stream = entry.Open()
Using reader As New StreamReader(entryStream)
Dim contents As String = reader.ReadToEnd()
' Process XML contents here using XMLDocument or similar
End Using
End Using
Exit For
End If
Next
End Using
End Using
End Using
End Using
Related Content
- 4 months ago