Notifications
Announcements
No record found.
Hi all,
I am having a word document uploaded to the temporary url. i want to download the document from the url to my local folder(folder creation using x++).
i am using FileUploadTemporaryStorageResult result = File::SendFileToTempStore_GetResult to generate the url.
if i use browser.navigate in my job. it's downloading automatically in "Downloads" folder in system . i want to create my own folder and then save/download the document there
Any suggestions plss
Hi Test Bot,
Have you tried file::sendFileToUser(stream,filePathAndName).
Hi Test_Bot,
D365 can't see or create any folders on your workstation, just like any other websites (luckily) can't. The system can just ask the browser to open a download dialog, and from there on it's up to the browser and the user to choose a location that they want.
You can set up the default download folder in your browser's settings.
Hi Wil Wu,
In that method parameters, its given as only _filename. how can store/addmy local folder path. any example code or reference
public static void SendFileToUser(System.IO.Stream stream, str fileName, ClassName fileUploadStrategyClassName = classstr(FileUploadTemporaryStorageStrategy))
{
}
Hi partner,
I don't have an environment to test for you right now, please check this blog, you can try pass the full path in the second parameter.
shootax.blogspot.com/.../x-d365fo-create-temp-file-and-save-to.html
I hav tried. but didn't got succceeded. can u provide any other suggestions.
As Nikolaos explained, what you're trying to do isn't possible. The web server doesn't have access to files on client machines.
As a workaround, you could make your local folder to FTP and drop the file from D365 using below code.
System.Byte[] bytes; System.Text.Encoding getUTF8; getUTF8 = System.Text.Encoding::get_UTF8(); System.Object request,response,credential; System.Net.FtpWebRequest ftpRequest; System.IO.Stream requestStream; System.IO.StreamReader streamReader = new System.IO.StreamReader(stream); bytes = getUTF8.GetBytes(streamReader.ReadToEnd()); request = System.Net.WebRequest::Create(new System.Uri("FTPURL")); ftpRequest = request; //Type casting object to ftpwebrequest object credential = new System.Net.NetworkCredential("UserName", "Password"); ftpRequest.set_Credentials(credential); ftpRequest.set_ContentLength(bytes.get_Length()); ftpRequest.set_Method('STOR'); requestStream = ftpRequest.GetRequestStream(); requestStream.Write(bytes,0,bytes.get_Length()); requestStream.Close();
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 584 Most Valuable Professional
André Arnaud de Cal... 499 Super User 2025 Season 2
Sohaib Cheema 254 User Group Leader