Forum Discussion
Hi Phil,
You can export the file to File Share folder and then run a copy step to copy the file to Documents/Public/xyz folder. Here is a sample code:
If args.CustomCalculateArgs.FunctionName.XFEqualsIgnoreCase("Move_File_from_FS_to_Public_Folder")
Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
Dim xfolderPath As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp(si,True, configsettings.fileShareRootFolder,si.AppToken.AppName)
Dim DestinationPath As String = "Cell_Details" '<-- This is the destination folder
Dim ParentPath As String = "Documents/Public" '<-- App Folder path where new folder will be added, may be updated
Dim fileToMove As String = "Cell_Details.csv"
Dim fileBytes As Byte() = File.ReadAllBytes(xfolderPath & "/" & fileToMove)
Dim targetDir As String = BRApi.FileSystem.GetFolder(si, FileSystemLocation.ApplicationDatabase, ParentPath & "/" & DestinationPath).XFFolder.FullName
Using dbConnApp As DBConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
'Save file in User's Temp folder in application DB
'(This will be cleaned up automatically be OneStream platform When user's session expires)
Dim dbFileInfo As New XFFileInfo(FileSystemLocation.ApplicationDatabase, fileToMove, targetDir, XFFileType.Unknown)
dbFileInfo.ContentFileContainsData = True
dbFileInfo.ContentFileExtension = dbFileInfo.Extension
Dim dbFile As New XFFile(dbFileInfo, String.Empty, fileBytes)
BRApi.FileSystem.InsertOrUpdateFile(si, dbFile)
End Using
End If
Related Content
- 8 months ago
- 5 months ago