我的VBScript应该更新具有特定主题的电子邮件的类别,但它不会保留。 [英] My VBScript is supposed to update the category of an email with a specific subject which it does but doesn't stay.

查看:75
本文介绍了我的VBScript应该更新具有特定主题的电子邮件的类别,但它不会保留。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我编写的脚本中粘贴了下面的代码,为我的团队清理了一个共享的电子邮箱。我的所有规则都将电子邮件移动到另一个文件夹或将其标记为已读/未读的工作而没有问题。当我尝试添加一个类别或标志时,我会发现奇怪的行为。


乍一看,当我只运行我的脚本时,电子邮件不会得到标志或类别。


如果我选择其中一封电子邮件并运行脚本,该电子邮件只会获得类别和标记。


如果我浏览并调试,所有电子邮件都会获得他们的类别和标志更新但不坚持。如果我关闭Outlook并重新打开它,标志和类别就会消失。



公共功能RunRule10()

   设置Outlook = CreateObject(" Outlook.Application"))
   设置inbox = GetFolderPath(" Support_Box\Inbox"))
    Set items = inbox.items

    Set item = items.Find(" [Subject] ='SBSC generic-Expedited request'")



  &NBSP;而TypeName(item)<> "没什么"

item.Unread = true

item.Categories =" Vanity"

item.FlagIcon = olRedFlagIcon

  &NBSP; &NBSP; &NBSP; Set item = items.FindNext

  &NBSP;结束
结束函数

解决方案

你需要选择检查员改变旗帜。 通过在GUI中执行此操作,您将默认检查器设置为邮件项目。


在Outlook VBA开发人员论坛中发布,以获取有关通过代码使用Outlook的指导。



I pasted my code below from a script I wrote to clean up a shared email box for my team. All my rules that move emails to another folder or mark them as read/unread work without issue. When I try to add a category or flag I get weird behavior.

At first glance, when i just run my script, the emails do not get either the flag or category.

If I select one of those emails and run the script, that email only gets the category and flag.

If I walk through and debug, all emails get their category and flag updated but it doesn't stick. If I close outlook and reopen it, the flags and categories are gone.

Public Function RunRule10()
    Set Outlook = CreateObject("Outlook.Application")
    Set inbox = GetFolderPath("Support_Box\Inbox")
    Set items = inbox.items
    Set item = items.Find("[Subject] = 'SBSC generic- Expedited request'")

    While TypeName(item) <> "Nothing"
item.Unread = true
item.Categories = "Vanity"
item.FlagIcon = olRedFlagIcon
        Set item = items.FindNext
    Wend
End Function

解决方案

You need to select the item in the inspector to change flags.  By doing it in the GUI you are setting the default inspector to a mail item.

Post in Outlook VBA developers forum for guidance of using Outlook via code.


这篇关于我的VBScript应该更新具有特定主题的电子邮件的类别,但它不会保留。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆