Forum Discussion

madsf's avatar
madsf
Copper Contributor
Jan 20, 2025

Stop trigger when receiving calendar invite for 'When a new email arrives in a shared mailbox'

I have created a flow which starts with the trigger 'When a new email arrives in a shared mailbox'. I would like to prevent this trigger starting the flow if I receive a calendar invite from any sender.

 

I have tried and tested a couple options with co-pilot which did not work:

  • Adding this function to the settings of the trigger '@not(equals(triggerOutputs()?['body/MessageClass'], 'IPM.Schedule.Meeting.Request'))' -> NO emails were triggering the flow any longer
  • Using a condition with the following function: '@contains(triggerOutputs()?['body/Categories'], 'Meeting')'

 

I am ideally going to avoid creating more steps in my flow, and instead working within the settings of the trigger. 

 

Please help! Below is the flow if at all helpful...

 

 

  • Mks_1973's avatar
    Mks_1973
    Iron Contributor

    Use a Trigger Condition with the Correct Expression

    When using trigger conditions on the When a new email arrives in a shared mailbox trigger, it’s important to reference the trigger’s payload exactly as it is returned. In most cases, using triggerBody() is preferable to triggerOutputs()?['body/…'].

    For example, add the following expression as a trigger condition in your trigger’s settings:

    NOt(equals(triggerBody()?['MessageClass'], 'IPM.Schedule.Meeting.Request'))


    In many cases, standard emails return a MessageClass value of "IPM.Note", while meeting invites (calendar invites) return "IPM.Schedule.Meeting.Request".

    Verify this by checking the output of the trigger


    ---------------------------------------

    Before locking in your trigger condition, it’s a good idea to check what properties are actually coming in. To do this:

    Temporarily Remove the Trigger Condition:   Remove or disable your trigger conditions so that every email starts the flow.

    Right after the trigger, add a Compose action with the input set to:

    triggerBody()

    Then Send Test Emails: Send both a standard email and a calendar invite to the shared mailbox.

    Examine the Flow Run History: Look at the output of the Compose action to verify:

    The exact property name (it should be MessageClass unless the schema is different)
    The values for standard emails (typically "IPM.Note") versus meeting invites (typically "IPM.Schedule.Meeting.Request")

     


    If you find that the MessageClass property isn’t being returned or is named differently in the payload, adjust your expression accordingly. For example, if it were named ItemClass (which is uncommon for emails but worth checking), your condition would change to:

    NOt(equals(triggerBody()?['ItemClass'], 'IPM.Schedule.Meeting.Request'))


    ------------------------------------------

    If even after verifying you still have trouble filtering within the trigger settings, you might consider these alternatives:


    Although you’d prefer not to add extra steps, you could add a Condition right after the trigger. In that condition, check if:

    equals(triggerBody()?['MessageClass'], 'IPM.Schedule.Meeting.Request')

    and if true (i.e., it’s a meeting invite), use the Terminate action to stop the flow.
    This ensures that even if the trigger fires, the flow ends immediately without further processing.

  • michalkornet's avatar
    michalkornet
    Iron Contributor

    Hi madsf I have reviewed the trigger data, and unfortunately, there is no information indicating that the email is connected to the event or invitation. I think you should explore possible ways to retrieve more details about the specific message using additional actions. There might be a clue indicating that it is an invitation.

     

     

Resources