none
Determine if MailItem is from InlineResponse? RRS feed

  • Question

  • Hello, 

    I am trapping Outlook's intrinsic ItemSend event. I am aware that the "Actions" method cannot be used for InlineResponse objects, but I'm working on something at the moment where I need to be able to block the Reply-All/Forward actions of the MailItem.

    I am able to do this as expected in the Inspector, but I'm having a bit of trouble in the InlineResponse. 

    Is there a way to detect if the Item in ItemSend is from an InlineResponse object? 

    I thought of throwing in a Try/Catch to see if I'm able to get to the Actions method, but I don't want to generate any unwanted exceptions in ItemSend! 

    Please help!

    Friday, October 3, 2014 4:34 AM

Answers

  • Well, the Actions property of Outlook items can't be used in that. As I already wrote, a possible scenario is to allow clicking on the Reply/ReplyAll/Forward button because there is no trivial way to disable them dynamically and add a user property which will indicate what actions are performed. In the ItemSend event handler you can stop sending if the user property is set.
    Friday, October 3, 2014 6:50 AM

All replies

  • Hello Rahul,

    You can handle the InlineResponse event of the Explorer class. It is fired when the user performs an action that causes an inline response to appear in the Reading Pane. Then you can check out the Recipients collection - whether it contains more than one recipient or not. The single recipient means the Reply button was hit. If multiple recipients are presented there the ReplyAll button was used.


    Note, to get the Outlook item which is shown in the inline response you need to use the ActiveInlineResponse property of the Explorer class. It returns an item object representing the active inline response item in the explorer reading pane.
    Friday, October 3, 2014 4:57 AM
  • What the actual problem that you are trying to solve? Which action cause the problem?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, October 3, 2014 5:11 AM
  • Hello Dmitry, 

    I just want to stop users from performing a "Reply to All" and "Forward" when sending out the email. 

    This works fine in the Outlook 2013 inspector, but when I trap ItemSend via InlineResponse's Send (note not the actually ItemSend for the InlineResponse but Application's) then I get an error that says 

    "This method cannot be used with an inline response...". (Because according to MSDN it's one of the "banned" methods)

    I wanted to know if there is a way to determine in Application's ItemSend if the Item is an InlineResponse, so I can place some logic to handle it. 

    e.g. the offending line is this

    Item.Actions("Reply to All").Enabled = False 'Error in InlineResponse item

    Friday, October 3, 2014 6:10 AM
  • Hello Eugene, 

    I want to trap this in Outlook's ItemSend not the Reply or ReplyAll event. 

    Friday, October 3, 2014 6:11 AM
  • I am not sure I understand what that will give you - the message is already being sent, why do you want to disable the "Reply All" action? What's' done is done, it is too late to change anything.

    Would you not want to disable that action before Reply or Reply All is actually invoked?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, October 3, 2014 6:18 AM
  • You're right. 

    I forgot to mention a few things Dmitry. 

    On the inline ribbon, I've placed 2 checkboxes.

    First checkbox allows user to enable/disable the Reply-All. Second checkbox allows user to enable/disable Forward. 

    Depending on which one user wants to disable, I set the property when the checkbox value changes (just a normal CheckedChanged call back). 

    So that raises an issue in the Inline Response...I can't actually access the "Actions" method. 

    Friday, October 3, 2014 6:33 AM
  • The fact is that the end user can add recipients manually. So, even if the Reply button was hit the response can be translated to reply all.

    If you need to process the item in the ItemSend event, i.e. later, you can add a user property which can tell what button was used - Reply or ReplyAll. Does it make sense?

    Friday, October 3, 2014 6:37 AM
  • I still do not understand why you need to access the actions when a message is being sent. This needs to be done *before* Forward or Replay All buttons are clicked.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, October 3, 2014 6:41 AM
  • Item.Actions("Reply to All").Enabled = False 'Error in InlineResponse item

    Where does the Item object come from?

    Do you use the ActiveInlineResponse property of the Explorer class?

    Friday, October 3, 2014 6:42 AM
  • Explorer class Eugene.
    Friday, October 3, 2014 6:42 AM
  • I access the Actions in ItemSend in the event the user has not checked any of the checkboxes...then I display a prompt asking the user if he/she wants to disable either ReplyAll/Forward (note this is done via a form). 

    That's the part where I'm stuck on. 

    Friday, October 3, 2014 6:44 AM
  • Why? It is too late - the message is already going out.

    Why not set a custom property with the value dependent on how the new message was created (Reply/Reply All/Forward) when it is created and check that property when ItemSend event fires?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, October 3, 2014 6:49 AM
  • Well, the Actions property of Outlook items can't be used in that. As I already wrote, a possible scenario is to allow clicking on the Reply/ReplyAll/Forward button because there is no trivial way to disable them dynamically and add a user property which will indicate what actions are performed. In the ItemSend event handler you can stop sending if the user property is set.
    Friday, October 3, 2014 6:50 AM