我目前正在处理method
下面的Inbox
,它会在我的filter
中回复电子邮件,但想知道如何static subject
他们专注于那些nice weather
的人,例如:folders.Items.Restrict()
。我认为condition is not valid
可以帮助我进行搜索,但我var fi = folder.Items.Restric("weather")
已var fi = folder.Items.Find("[Subject] = weather")
了static void IterateMessages(Outlook.Folder folder)
{
string[] extensionsArray = {".csv"};
//var fi = folder.Items;
var fi = folder.Items.Restrict("weather");
if (fi != null)
{
foreach (Object item in fi)
{
Outlook.MailItem mi = (Outlook.MailItem)item;
var attachments = mi.Attachments;
if (attachments.Count != 0)
{
if (!Directory.Exists(basePath)
{
Directory.CreateDirectory(basePath);
}
// Loop through each attachment
for (int i = 1; i <= mi.Attachments.Count; i++)
{
Console.WriteLine("Processing: {0}", mi.Attachments[i].FileName);
mi.Attachments[i].SaveAsFile(basePath);
Console.WriteLine("Attachment: {0}" + " Saved to Path", mi.Attachments[i].FileName);
}
}
}
}
}
。我也试过了
JRE_HOME
,以确保条件有效,......但最终没有任何改进。
提前致谢
[exec] The JRE_HOME environment variable is not defined correctly
[exec] This environment variable is needed to run this program
[exec] Result: 1
答案 0 :(得分:3)
您的Restrict
参数似乎格式错误。试试这个:
var fi = folder.Items.Restrict("@SQL=\"urn:schemas:httpmail:subject\" like '%weather%'";