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

To be used with an Extender rule to export data from the stage for a Workflow Profile

 

Select Case args.FunctionType     
    Case Is = ExtenderFunctionType.Unknown, ExtenderFunctionType.ExecuteDataMgmtBusinessRuleStep
        'Prepare the Stage Data Extract File path
        Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
        Dim folderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp(si, True, configSettings.FileShareRootFolder, si.AppToken.AppName) & "\" & DateTime.UtcNow.ToString("yyyyMMdd") & "\MetadataExtracts"
        If Not Directory.Exists(folderPath) Then Directory.CreateDirectory(folderPath)
   
        Dim filePath As String = folderPath & "\" & si.AppToken.AppName & ".zip"    
        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)
                        BW.Write(zipBytes)
                    End Using
                End Using
            End Using
        End Using
            
End Select
Version history
Last update:
‎04-25-2022 08:26 AM
Updated by:
Contributors