Showing results for 
Search instead for 
Did you mean: 
Community Manager
Community Manager

Extender buiness rule that all application metadata to a zip file for the current application.
The files are written to the application Data Mgmt Export folder in the file share directory.


'Prepare the Stage Data Extract File path
Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
'Folder path to save export
Dim folderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp(si, True, configSettings.FileShareRootFolder, si.AppToken.AppName) & "\" & DateTime.UtcNow.ToString("yyyyMMdd") & "\MetadataExtracts"
'Check if folder path for export exists
If Not Directory.Exists(folderPath) Then Directory.CreateDirectory(folderPath)
    Dim filePath As String = folderPath & "\" & si.AppToken.AppName & ".zip"    
'Check if file already exists.  If so then delete exsiting copy
If File.Exists(filePath) Then File.Delete(filePath)

'Set the extract options
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)
        'Append the contents of this workflow profile to the extract file               
        Using FS As New FileStream(filePath, FileMode.Append, FileAccess.Write)   
            'Create a binary writer, and write all bytes to the FileStream at once
            Using BW As New BinaryWriter(FS)
            End Using
        End Using
    End Using
End Using
Version history
Last update:
‎04-25-2022 08:16 AM
Updated by: