AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 19.05.2009, 22:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
axaptapedia: FtpWebRequest
Источник: http://www.axaptapedia.com/FtpWebRequest
==============

Summary: New page: Since version 4 and in version 2009 you may use the .NET framework inside Dynamics AX. The FtpWebRequest class in the System.Net namespace handles FTP communication like upload, download, ...

Since version 4 and in version 2009 you may use the .NET framework inside Dynamics AX. The FtpWebRequest class in the System.Net namespace handles FTP communication like upload, download, delete files and retrieve a list of files in a directory, etc.

==Upload File==

X++:
static void uploadTestFile(Args _args)
{
    object ftpo;
    object ftpResponse;
    System.Net.FtpWebRequest request;
    System.IO.StreamReader reader;
    System.IO.Stream requestStream;
    System.Byte[] bytes;
    System.Net.NetworkCredential credential;
    System.String xmlContent;
    System.Text.Encoding utf8;

    System.Net.FtpWebResponse response;
    ;

    // Read file
    reader = new System.IO.StreamReader("C:/test.xml");
    utf8 = System.Text.Encoding::get_UTF8();
    bytes = utf8.GetBytes( reader.ReadToEnd() );
    reader.Close();

    // little workaround to get around the casting in .NET
    ftpo = System.Net.WebRequest::Create("ftp://ftp.company.com/dir/test.xml");
    request = ftpo;
    
    credential = new System.Net.NetworkCredential("user","password");
    request.set_Credentials(credential);
    request.set_ContentLength(bytes.get_Length());
    request.set_Method("STOR");

    requestStream = request.GetRequestStream();
    requestStream.Write(bytes,0,bytes.get_Length());
    requestStream.Close();
    
    ftpResponse = request.GetResponse();
    response = ftpResponse;
    info(response.get_StatusDescription());
}
[[Category:.NET Development]]


Источник: http://www.axaptapedia.com/FtpWebRequest
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Теги
ftp, загрузка

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axcoder: PowerShell + Ax Blog bot DAX Blogs 1 09.01.2009 18:05
axaptapedia: Load Web Documents Blog bot DAX Blogs 1 03.01.2009 23:50
axcoder: AxPath is supported by axaptapedia Blog bot DAX Blogs 0 11.05.2007 10:00
axaptapedia: ElementVersionTrack Blog bot DAX Blogs 0 27.04.2007 17:10
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 14:18.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.