The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.

Forum Discussion

jrodgers's avatar
jrodgers
New Contributor II
2 years ago
Solved

Move file from File Explorer to File Share

I need to create a business rule that will move a file from a user's folder in File Explorer to the server's File Share. I am using the BRApi.FileSystem.GetFile method to successfully read the file, ...
  • manthangandhi's avatar
    2 years ago

    Hi Jrodgers,

    You can try the follwoing apprach to move the file from the user's public directory to File Share > applications > Groups > Everyone directory. I hope this is what you're looking for.

    'Get the file
    Dim sourceXFFileEx As New XFFileEx
    Dim sourceDir As String = "Documents/Users/" & si.UserName.Replace(" ","")
    Dim sourceFile As String = "test_move.txt"
    sourceXFFileEx = BRApi.FileSystem.GetFile(si, FileSystemLocation.ApplicationDatabase, sourceDir & "/" & sourceFile,True,True)

    'Save the file but this part is not working  

    Dim tgt = brapi.FileSystem.GetFolder(si, FileSystemLocation.FileShare, "Applications/"& si.AppName.Replace(" ", String.Empty) & "\Groups\Everyone\").XFFolder.ParentFullName
    Dim targetFileDataInfo As New XFFileInfo(FileSystemLocation.FileShare, sourceFile, tgt )
    Dim targetFileData As New XFFile(targetFileDataInfo, String.Empty, sourceXFFileEx.XFFile.ContentFileBytes)
    BRApi.FileSystem.InsertOrUpdateFile(si, targetFileData)