Reading a file written to a user folder.

ssmith-nova
New Contributor III

I have the routine below that exports data from a datatable to a file.  I am writing to "Documents\Users\" & si.UserName.   The file gets created correctly; I am now trying to pick up that file with a business rule.  I am not familiar with all of the XF file functions.  I need to ftp that file to a remote server. 

How do I go about getting the full path the Document\Users folder from another Business Rule.

Public Function DataTableToFile(ByVal si As SessionInfo, ByVal dt As DataTable, ByVal strFilePath As String, ByVal listColToSkip As List(Of String), ByVal Optional strSeparator As String = ",") As XFFileEx

	Dim strDt As String = Me.PrintDataTable(si, dt, strSeparator, 0, False, listColToSkip, """")
	Dim bytes() As Byte = System.Text.Encoding.UTF8.GetBytes(strDt)

	Dim fileinfo As New XFFileInfo(fileSystemLocation.ApplicationDatabase, strFilePath)
	Dim xfFile As New XFFile(fileinfo, String.Empty, bytes)
	BRApi.FileSystem.InsertOrUpdateFile(si, xffile)

	Dim xfeFile As New XFFileEx(xffile, DataAccessLevel.AllAccess, False)
	Return xfeFile

End Function

 

1 ACCEPTED SOLUTION

Well, i think there are differences depending on where you save it:

KarlT_0-1722937943691.png

The file share are actual folders (grey) i think, whereas the Documents/Public etc. sit on the Application Database.

View solution in original post

3 REPLIES 3

KarlT
Contributor II

Would something like this be what you're looking for?

Dim targetDir As String = BRApi.FileSystem.GetFolder(si,FileSystemLocation.ApplicationDatabase, "Documents/Public").XFFolder.FullName

 

ssmith-nova
New Contributor III

I tried that, it returned just "Documents\Public", when I go to read the file there it says it does not exist.  Do the files under Documents\ get written to a physical disk or are they saved in the database? Is that why we have to use all of the XF functions to get the file vs anything saved to the "File Share" 

Well, i think there are differences depending on where you save it:

KarlT_0-1722937943691.png

The file share are actual folders (grey) i think, whereas the Documents/Public etc. sit on the Application Database.