How to write a file on server folder - platform 8.1

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 18, 2012
Company:

Hello everybody,
I need to save file at server side, I mean where 1C server works.
Example below tries to save a file at client side. Is it possible to save this file in "E:\Folder" but at server? How to do it?
Platform version: 8.1.12.98
Thank you in advance for every your answer.
Kris

Code
FileName="E:\Folder\File.xml";

File = New File(FileName);
Text = New TextWriter(FileName, TextEncoding.UTF8);
X = New XMLWriter;
X.SetString("UTF-8");

...(creating XML structure)...

StrXML = X.Close();
   
Text.Write(StrXML); 
Text.Close(); 

 
#2
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear Kris,

You can specify the "&AtServer" compilation directive for your procedure or function. As a result, this piece of code will address to file resources of the computer where 1C:Enterprise server's rphost.exe process runs.

To be able to successfully access the file resources, the user on behalf of whom you run the rphost process should have appropriate rights to them.

Best regards,
Vladimir Gurov

1C Company support team
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.