Основной сайт хуманэмулятор.рф | Демо | Купить | API | Wiki
Web / outlook
get_message_as_msg_file_by_attachment_name
get_message_as_msg_file_by_attachment_name($folder,$folder_to_save,$name,$exactly=false,$number=0,$readed="all",$timeout=300); - Получить письмо с заданным именем вложения как файл .msgВарианты значений $readed:
"all" - получить все сообщения;
"unreaded" - получить непрочитанные сообщения;
"readed" - получить прочитанные сообщения.
Функция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php // Scenario: Get and save a message as .msg file from Outlook by folder and attachment name $xhe_host = getenv("RPABOT_HOST_URL"); if (!isset($path)){ // Path to the init.php file for connecting to the XHE API $path = "../../../Templates/init.php"; // Including init.php grants access to all classes and functionality for working with the XHE API require($path); } echo "\n<span>outlook->" . basename (__FILE__) . "</span>\n"; // Step 1. Open Outlook app echo("Open Outlook app: "); $openResult = WEB::$outlook->open(false); if ($openResult) echo("\n Open Outlook app is success"); else echo("\n Open Outlook app is fail"); // Example 1. Get and save a message as .msg file from Outlook by folder and attachment name $outlookFolder = "\\\\test@mail.ru\\Inbox"; $folderPath = "test"; $attachmentName = "png"; $exactMatch = false; $timeout = 0; $readFlag = "all"; echo("\n\nExample 1. Get and save a message as .msg file from Outlook by folder 'Inbox' and attachment name 'png': "); $getResult = WEB::$outlook->get_message_as_msg_file_by_attachment_name($outlookFolder, $folderPath, $attachmentName, $exactMatch, $timeout, $readFlag); if ($getResult) echo("\n Get message success. File can find at path: $getResult"); else echo("\n Get message fail"); // Example 2. Get and save a message with exact attachment name match $attachmentNameExact = "image.png"; $exactMatchExact = true; echo("\n\nExample 2. Get and save a message with exact attachment name match: "); $getResult = WEB::$outlook->get_message_as_msg_file_by_attachment_name($outlookFolder, $folderPath, $attachmentNameExact, $exactMatchExact, $timeout, $readFlag); if ($getResult) echo("\n Get message success. File can find at path: $getResult"); else echo("\n Get message fail"); echo "\n"; // Quit WINDOW::$app->quit(); ?>
#region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program:XHEScript { static void Main(string[] args) { // init XHE server = Environment.GetEnvironmentVariable("RPABOT_HOST_URL"); InitXHE(); // начало echo("<hr><font color=blue>outlook->get_message_as_msg_file_by_attachment_name</font><hr>"); // 1 echo("1. Get and save a message as .msg file from Outlook by folder 'Inbox' and attachment name 'png': "); string result = outlook.get_message_as_msg_file_by_attachment_name("\\\\test@mail.ru\\Inbox", "test", "png", false, 0, "all"); if (!string.IsNullOrEmpty(result)) echo("\n Get message success. File can find at path: " + result); else echo("\n Get message fail"); // 2 echo("\n2. Get and save a message with exact attachment name match: "); result = outlook.get_message_as_msg_file_by_attachment_name("\\\\test@mail.ru\\Inbox", "test", "image.png", true, 0, "all"); if (!string.IsNullOrEmpty(result)) echo("\n Get message success. File can find at path: " + result); else echo("\n Get message fail"); // конец echo("\n"); // Quit app.quit(); } }
xhe_host = "127.0.0.1:3039";
echo=require("../../../Templates JS/init.js");
// начало
echo("<hr><font color=blue>outlook->get_message_as_msg_file_by_attachment_name</font><hr>");
// 1 шаг
echo("1. Откроем приложение Outlook : ");
echo(outlook.open(false));
// Пример 1. Получим и сохраним сообщение как .msg файл из Outlook по папке и имени вложения
outlookFolder = "\\\\test@mail.ru\\Inbox";
folderPath = "test";
attachmentName = "png";
exactMatch = false;
timeout = 0;
readFlag = "all";
echo("\n\n2. Получим и сохраним сообщение как .msg файл из Outlook по папке 'Inbox' и имени вложения 'png': ");
getResult = outlook.get_message_as_msg_file_by_attachment_name(outlookFolder, folderPath, attachmentName, exactMatch, timeout, readFlag);
if (getResult)
echo("\n Получение сообщения успешно. Файл можно найти по пути: " + getResult);
else
echo("\n Получение сообщения не удалось");
// Пример 2. Получим и сохраним сообщение с точным совпадением имени вложения
attachmentNameExact = "image.png";
exactMatchExact = true;
echo("\n\n3. Получим и сохраним сообщение с точным совпадением имени вложения: ");
getResult = outlook.get_message_as_msg_file_by_attachment_name(outlookFolder, folderPath, attachmentNameExact, exactMatchExact, timeout, readFlag);
if (getResult)
echo("\n Получение сообщения успешно. Файл можно найти по пути: " + getResult);
else
echo("\n Получение сообщения не удалось");
// конец
echo("\n");
// Quit
app.quit();=============================================
outlook Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.