首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Outlook约会- ItemChange和Outlook活动

Outlook约会- ItemChange和Outlook活动
EN

Stack Overflow用户
提问于 2013-05-24 16:27:57
回答 1查看 1.8K关注 0票数 0

我想将约会项目从一个日历同步到另一个日历。我实现了一个基于特定UserProperty更新约会的ItemChange处理程序。现在,我想当我删除一个约会时,ItemRemove事件被触发,我可以处理其他日历中的删除,但事实上,ItemChange事件首先被触发。

如何检查传递的项是否已删除,以便在ItemChange处理程序中忽略这种情况?我尝试检查Null、Nothing或Empty,但Item对象是一个约会,其中大多数属性(EntryId、UserProperies等)导致错误。

下面是一些简化的代码,它们应该有助于理解我的问题

代码语言:javascript
复制
 Private Sub newCal_ItemChange(ByVal Item As Object)
  Dim appointment As Outlook.appointmentItem
  Set appointment = Item
  If (appointment <> deleted) Then
   ' update other calendars
  Else
   ' do nothing and proceed with ItemRemove Event
  End If
 End Sub
EN

回答 1

Stack Overflow用户

发布于 2013-10-16 18:57:51

这很简单:只需使用事件_ItemAdd,但在回收站文件夹!!例如:

代码语言:javascript
复制
Private WithEvents trashCalendar1 As Outlook.Items
...
Private Sub trashCalendar1_ItemAdd(ByVal Item As Object)
    Dim objNS As Outlook.NameSpace
    Set objNS = Outlook.Application.GetNamespace("MAPI")
    Dim result As Boolean
    '
    result = ...'here the actual boolean sync removing function on calendar2
                'where you'd use your custom userproperty to find the item to delete 
                'in the calendar2-related folder
    If result Then
      MsgBox "sync removed"
    End If
End Sub
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16730658

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档