Reading file from presonal enviroment

Reading file from presonal enviroment

  

Hi,

I wanted to test Fileread_Text server action, but (I guess) because I'm using the personal (cloud) enviroment a message pops up that the file cannot be found. Then I thought of adding the file to the Resources and tried (in 'Path'):

/appname/resourcename or just resourcename  

but it cannot find the file, or a denied message appears. 

What's the proper way to test this?

Regards, Harry


Hi Harry,

If file is there at resource directory, You can use BinaryDataToText function present in BinaryData extension.

Sachin

Hi Sachin,

It does not work. Am I using it correct?

Resources.testmail1_html ?

Harry

Hi Harry, It should be like Resources.testmail1_html.content 

Sachin

Did you also changed the "deploy action" from "Do Nothing" to "Deploy to target directory" ?


J. wrote:

Did you also changed the "deploy action" from "Do Nothing" to "Deploy to target directory" ?


Did not know that. I now did. 

How do I use the Path ? 

SyntaxEditor Code Snippet

"/appname/resourcename"

does not work. 

@"/appname/resourcename"

I cannot use it seems.

Harry

Hi Harry, 

What about the solution that I gave you, Is it working?

Sachin

Hi Sachin,

Yes, perfectly!

I'm stille curious how to use the Path in Fileread_Text though.

Regards, Harry

Hi Harry,

Try Path_GetApplicationDirectory function, It will return you the application direcotory path, concatenate the path with following string "\bin2\hidden_resouces\testmail1_html.txt  as

Path_GetApplicationDirectory.ApplicationDirectory+"\bin2\hidden_resources\testmail1_html.txt"

Provide this path as input to the File_ReadText function, It will work for you.

Sachin

Hi Sachin,

 when I use:

Path_GetApplicationDirectory.ApplicationDirectory+"\bin2\hidden_resources\testmail1_html.txt"

I get "unkown object Path_GetApplicationDirectory in expression"

Harry 

Hi Harry,

Take the reference of the function from FileSystem extention and use it above file_readText. 

Cheers!

Sachin