We are under construction!
You may experience downtime, errors or visual oddities, but we anticipate all will be resolved by the end of the day.
You may experience downtime, errors or visual oddities, but we anticipate all will be resolved by the end of the day.
Its a bit kludgy, but it should get you what you're after:
(Change the assignment of maintUnitToExtract to the name of your maintenance unit)
Dim isExtractAllItemsTrue = True
Dim isExtractUniqueIdsTrue = True
Dim xmlOptions As New XmlExtractOptions(isExtractAllItemFalse, isExtractUniqueIdsTrue)
Dim xmlString As String = String.Empty
Dim maintUnitToExtract As String = "GolfStream Charts"
' extract specified items doesn't seem to work, but we need it
Dim extractDict As New Dictionary(Of XmlExtractItemPk, Boolean) From {
{New XmlExtractItemPk(XmlExtractItemType.DashboardMaintUnit, maintUnitToExtract), True}
}
'Execute the Metadata Extract
Using dbConnFW As DBConnInfo = BRAPi.Database.CreateFrameworkDbConnInfo(si)
Using dbConnApp As DBConnInfo = BRAPi.Database.CreateApplicationDbConnInfo(si)
xmlString = XmlExtractController.ExtractXML(dbConnFW, dbConnApp, Nothing, xmlOptions, extractDict, XmlLoadExtractType.ApplicationWorkspaces)
End Using
End Using
Dim xmlDoc As XDocument = XDocument.Parse(xmlString)
Dim extractedMaintUnitElement As XElement = xmlDoc.Descendants("maintenanceUnit").Where(Function(mu) mu.Attribute("name").Value = maintUnitToExtract).FirstOrDefault()
If extractedMaintUnitElement IsNot Nothing Then
Dim workspaceElement = extractedMaintUnitElement.Ancestors("workspace").FirstOrDefault()
Dim newWorkspaceElement As New XElement("workspace", workspaceElement.Attributes())
newWorkspaceElement.Add(New XElement("maintenanceUnits", extractedMaintUnitElement))
Dim newXmlDoc As New XDocument(
New XElement("OneStreamXF", xmlDoc.Root.Attributes(),
New XElement("applicationWorkspacesRoot",
New XElement("workspaces", newWorkspaceElement)
)
)
)
newXmlDoc.Save(filePath)
End If
this is probably doable with their library methods, but I don't have time to figure it out today. I can look again tomorrow.
RobbSalzmann How would you write your code to only extract one specific Dashboard and one specific component, lets say?
Thanks RobbSalzmann !