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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 694

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 646 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 337

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans