Outlook VBA可以在传入的电子邮件中更改主题,移动电子邮件和创建任务

时间:2017-09-22 18:28:45

标签: vba email outlook

所以我有一些基础知识,但我无法弄清楚如何做一些事情,如创建任务或移动电子邮件。我创建了一个脚本来手动更新主题,但这并不能帮助我完成最终目标。

问题不是最好的方法,但它确实有效。基本上我需要在收到新电子邮件时关闭此功能,如下所述编辑主题,将其移动到子文件夹....让我们将其称为1,并创建一个2天的任务来完成。 / p>

start-process powershell C:\Scripts\URLwatcher\ManualScrape.ps1
----------------------------------------------------------------

#Debugger \\ Set-PSDebug -Trace 1

#Create a timestamp var
$movetimestamp = (Get-Date -Format yyyy-mm-dd-hhmmss)

#Create a timestamp file name
$timestampedURLfile = "C:\Scripts\URLwatcher\processing\" + $movetimestamp + ".txt"

#Move URL file and rename it
move-item C:\Scripts\tmp\data.txt $timestampedURLfile

#Extract & store the URL from the file
$addURL = Get-Content $timestampedURLfile

#Run the scraper
cd C:\Scripts
python.exe DailyStats.py -l $addURL

#Delete the URL file
del $timestampedURLfile

1 个答案:

答案 0 :(得分:2)

以下是移动电子邮件的方法:

    $this->context->cart->deleteProduct(1);

    Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'specific_price WHERE  id_customer='.(int)$this->context->customer->id);

您还可以Sub MoveItems() Dim myNameSpace As Outlook.NameSpace Dim myInbox As Outlook.Folder Dim myDestFolder As Outlook.Folder Dim myItems As Outlook.Items Dim myItem As Object Set myNameSpace = Application.GetNamespace("MAPI") Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox) Set myItems = myInbox.Items Set myDestFolder = myInbox.Folders("Test") Set myItem = myItems.Find("[Subject] = '[Subject Name]'") While TypeName(myItem) <> "Nothing" myItem.Move myDestFolder Set myItem = myItems.FindNext Wend End Sub 等于Set myItem = myItems.Find("[Subject] = '[Subject Name]'"),但请注意,它会找到所有发件人或主题名称的电子邮件。以下代码将更改电子邮件的主题名称。

Set myItem = myItems.Find("[SenderName] = '[Sender Name]'")

以下是有关创建任务https://www.devhut.net/2010/09/03/vba-create-an-outlook-task/

的文章的链接