web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

facing build errors with disabling the proxy of FTP web request

(0) ShareShare
ReportReport
Posted on by 157
Hi every one,
I had a simple requirement to upload a csv file to the FTP server.
Below is my code,
void export()
{
ProjPlanVersion projPlanVersion;
ProjPlanVersionDetail projPlanVersionDetail;
CompanyInfo companyInfo = CompanyInfo::find();
String10 dataAreaId;

TextStreamIo commaIO = TextStreamIo::constructForWrite();
commaIO.outFieldDelimiter(#Semicolon);
System.Object webRequest,response,credential;
System.Net.FtpWebRequest ftpWebRequest;
System.Net.FtpWebResponse ftpWebResponse;
System.IO.Stream requestStream;
System.Byte[] bytes;
System.Text.Encoding getUTF8;
CLRObject sysException;
Hours hr;
Minutes minute;
str hrStr;
str minuteStr;
hr = DateTimeUtil::hour(DateTimeUtil::getSystemDateTime());
hrStr = hr > 9 ? any2str(hr) : ('0' + any2Str(hr));
minute = DateTimeUtil::minute(DateTimeUtil::getSystemDateTime());
minuteStr = minute > 9 ? any2str(minute) : ('0' + any2Str(minute));
//str ftpurl = "">ftp.current.no/testfile.csv";
str ftpurl = "">ftp.current.no/.../" + 'Project' + #Underscore + date2Str(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()), 321, DateDay::Digits2, DateSeparator::None, DateMonth::Digits2, DateSeparator::None,DateYear::Digits4) + #Underscore + hrStr + minuteStr + #csv;
new InteropPermission(InteropKind::ClrInterop).assert();
str ftpfullpath = ftpurl;
}
// wirite content to file
commaIO.writeExp([dataAreaId,companyInfo.Name,ProjTable::find(projPlanVersionDetail.ProjId).Name,projPlanVersionDetail.ProjId,ProjTable::find(projPlanVersionDetail.ProjId).Name,projPlanVersionDetail.ProjId,projPlanVersion.TaskCategory]);
try
{
// read csv file
System.IO.Stream stream = commaIO.getStream();
stream.Position = 0;
System.IO.StreamReader reader = new System.IO.StreamReader(stream);
getUTF8 = System.Text.Encoding::get_UTF8();
bytes = getUTF8.GetBytes(reader.ReadToEnd());
reader.Close();
// write file in FTP
webRequest = System.Net.WebRequest::Create(ftpfullpath);
ftpWebRequest = webRequest;
credential = new System.Net.NetworkCredential('bakke', #Ftppassword);
ftpWebRequest.set_Credentials(credential);
ftpWebRequest.set_ContentLength(bytes.get_Length());
ftpWebRequest.set_Method('STOR');
ftpWebRequest.set_Proxy(NULL); //commented only because to avoid Build errors from Build Automation while SDP.
requestStream = ftpWebRequest.GetRequestStream();
requestStream.Write(bytes,0,bytes.get_Length());
requestStream.Close();
response = ftpWebRequest.GetResponse();
ftpWebResponse = response;
}
Catch(Exception::CLRError)
{
sysException = CLRInterop::getLastException();
info(sysException.get_Message());
}
}
from the above code I am getting build error CLR type System.Net.IwebProxy  is not found in any reference assembly.
but I included all the assemblies. Does any one know how to solve this.
I have the same question (0)

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans