Update: Thanks Ellis for directing me towards the correct path. Wanted to update the post so others could get help.
In Auto reply there can be Four scenarios and each scenario will return a different format when "Get Mail Tips for all mailbox (V2)" is used.
1st Scenario as you mentioned above "who don't have automatic replies enabled, the message property is empty:"
[
{
"mailboxFull": false,
"externalMemberCount": 0,
"totalMemberCount": 1,
"deliveryRestricted": false,
"isModerated": false,
"maxMessageSize": 37748736,
"emailAddress": {
"name": "",
"address": "user@email.com"
},
"automaticReplies": {
"message": ""
}
}
]
2nd Scenario as your mentioned above "users who have automatic replies enabled, the message property contains text:"
[
{
"mailboxFull": false,
"externalMemberCount": 0,
"totalMemberCount": 1,
"deliveryRestricted": false,
"isModerated": false,
"maxMessageSize": 37748736,
"emailAddress": {
"name": "",
"address": "user1@email.com"
},
"automaticReplies": {
"message": "I'm out of the office ...."
}
}
]
3rd Scenario as you mentioned above "who have automatic replies enabled, some have set a scheduled start and end time:"
[
{
"mailboxFull": false,
"externalMemberCount": 0,
"totalMemberCount": 1,
"deliveryRestricted": false,
"isModerated": false,
"maxMessageSize": 37748736,
"emailAddress": {
"name": "",
"address": "user2@email.com"
},
"automaticReplies": {
"message": "I'm out of the office ....",
"scheduledStartTime": {
"dateTime": "2022-04-14T16:00:00.0000000",
"timeZone": "UTC"
},
"scheduledEndTime": {
"dateTime": "2022-05-04T08:30:00.0000000",
"timeZone": "UTC"
}
}
}
]
The Fourth Scenario is when User have auto reply message set but autoreply is not active. i.e. previously an auto reply was active but then was disabled. this will return an empty object i.e. "automaticReplies": {}.
I tried using condition to check if the output is 0 but was having the issues as {} is not 0 hence i was getting it wrong.
I used empty() function with target to "automaticReplies/messages" if true means user is in office and false means user is out of office.
Hope this help others.