none
How to ignore ModifiedEvents for Folders in Notifications? RRS feed

  • Question

  • I'm using the Push-Notifications to recieive new/changed/deleted/moved items. I want only the Items, like CalendarItems. Not the folders!

    But the notifications sends Events for both, folders and items.

    The big problem is, that when i enter the calendar in Outlook, and leave it, i get also ModifiedEvents.

    There are 2 or 4 ModifiedEvents in the Notification. Some have a ItemId and some have a FolderId. Those with the FolderID are ModifiedEvents for the subscribed folder. But those with the itemid, i don't know, for what they are. When i try to get the whole items by this id from exchange, i get a exception, that i requested invalid propertys.

    I think, those with the ItemId are also Events from the folder. Folders have other propertys, than items.

     

    So i don't know, how to kick the folder-events out.

    Monday, February 7, 2011 3:57 PM

Answers

  • Ok, i have a solution. It isn't elegant, but it works.

    When i receive a notification, i first get the item via GetItem() but without AdditinalPropertys. Only the Object empty with the ItemId. After that i know, witch type this object is, ans so i can decide what to do with it. Ignore or get it again via GetItem() but this time with AdditionalPropertys.

    So i have to get the object twice.

     

    The funny thing is, that when i leave the calendar in outlook, i get two ModifiedEvents for the folder (with FolderIdType), and two ModifiedEvents with ItemIdType. I looked, what type this items have, witch comes with the ItemIdtype. It ist the MessageType! Empty MessageType-Objects.

    I realy don't know why, because i leave the calendar. There are no messages. An even in the mailbox i have only one message.

     

    But now that i know, that these items are MessageTypes, i can ignore them, while i receive notifications.

    • Marked as answer by GambaJo Tuesday, February 8, 2011 10:35 AM
    Tuesday, February 8, 2011 10:34 AM

All replies

  • I don't believe these can be filtered out from the Exchange side.  It's easy enough to detect a FolderId vs. an ItemId, so you can just bypass them as you process the notification batch.  In my experience Exchange loves sending notifications for just about anything.  You very often get notifications for ItemIds that no longer exist in the store, and you have to code defensively against that.  I should say that I've not really dug into anything newer that might have been done in E2010, since I wrote most of my app code for E2007 and it handles E2010 without any big mods.

    HTH,

    Paul


    --Paul
    Monday, February 7, 2011 10:58 PM
  • Yes, i know, that i can't filter it on the exchange side. I was searching for a attribute of the ModifiedEvents on witch i can differentiate, if it's a real item, or something else.

    My application waits for notifications from exchange. When a notification arrvies, the application try to decide, if it's a status-event, or a real event. If it's a real event, the application trys to get the item with GetItem() and AdditionalPropertys. The problem is, that when i leave the calendar in outlook, the application get some ItemIds, that i can get via GetItem(). But this items don't like my AdditionalPropertys, because i get a ErrorInvalidPropertyRequest.

    The error isn't in my AdditionalPropertys, because it works, when i try to get a real item (CalendarItem fpr example).

     

    So i don't know, how to decide on the application side, if the received ItemId is a real item. I have to check every event, because every event can be a real item.

    I had an idea, but it didn't work very well. I tried to compare the id from the received event with the id of the submitted folder. My idea was, that if the ids are the same, this event comes from the folder, and i can ignore it.

    But it didn't t work, because the ids, witch i received are nearly the same, like the ids from the submitted folder, but longer. I think, this ids contains the id of the folder and the id of the mailbox. So i can't compare them.

    My application is a windows service. For now it get the exception, and goes on. But this exceptions are logged in the event-log. So this would look strange for the admins, who have to use this service.

    Tuesday, February 8, 2011 7:28 AM
  • Ok, i have a solution. It isn't elegant, but it works.

    When i receive a notification, i first get the item via GetItem() but without AdditinalPropertys. Only the Object empty with the ItemId. After that i know, witch type this object is, ans so i can decide what to do with it. Ignore or get it again via GetItem() but this time with AdditionalPropertys.

    So i have to get the object twice.

     

    The funny thing is, that when i leave the calendar in outlook, i get two ModifiedEvents for the folder (with FolderIdType), and two ModifiedEvents with ItemIdType. I looked, what type this items have, witch comes with the ItemIdtype. It ist the MessageType! Empty MessageType-Objects.

    I realy don't know why, because i leave the calendar. There are no messages. An even in the mailbox i have only one message.

     

    But now that i know, that these items are MessageTypes, i can ignore them, while i receive notifications.

    • Marked as answer by GambaJo Tuesday, February 8, 2011 10:35 AM
    Tuesday, February 8, 2011 10:34 AM