The xmlExtractOptions object has properties that control what is extracted (eg XmlLoadExtractType.ApplicationDashboards). Unfortunately I haven't found any documentation and intellisense doesn't work. In short the way I do it is extract everything and then read the output zip file and pick off the Metadata.XML file like this:
' You will need these imports:
' Imports System.IO.Compression
' Imports System.Xml
Dim xmlOptions As New XmlExtractOptions
xmlOptions.ExtractAllItems = 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()
' Save file ...
End Using
End Using
Exit For
End If
Next
End Using
End Using
End Using
End Using
If you then want a particular dimension, I would load the file into an XML document and parse out the dimension you want. Then convert it to a csv file.