Get Email Size in UiPath Studio

I want to get the email size of the email from a shared email Box not email attacments size or Email Body Size in studio Web. I have requirement to retrieve email size and check if email size is greater than 5 mb then stop the maestro flow.

I tried using microsoft outlook 365 http request by providing the url with email id, email message id but it is not exposing the size of the email property.

Is there any way to get the email size directly from property or any activity.

@Anil_G

hi @Sandeep_Allak,

The email size is available through Microsoft Graph as the size property (returned in bytes).

If you’re using a Graph request, make sure you’re calling the Message endpoint and that your $select (if used) includes size, for example:

GET /users/{sharedMailbox}/messages/{messageId}?$select=id,size

You can then compare the returned value against 5 * 1024 * 1024 (5 MB) and stop the Maestro flow if it exceeds the limit.

If size isn’t being returned, please share the Graph URL you’re using and a sample of the response so we can check further.

@Sandeep_Allaka

this property might help you PidTagMessageSize Canonical Property | Microsoft Learn

with same http request use expand

/messages?$expand=singleValueExtendedProperties($filter=id eq 'Integer 0x0E08')

cheers

@Anil_G unfortunately I am still not able to see the size in the output response with expression provided. Status code = 200 but the property is still not exposed. singleValueExtendedProperties itself is not seen

I am using the same url which you mentioned. It says size property is not found. I am also getting 400 error.

/users/{sharedMailboxEmailID}/messages/{messageId}?$select=id,size

Could you share the full 400 error and confirm whether you’re using the Microsoft Graph HTTP Request activity or the Microsoft 365 connector in Studio Web?

@Sandeep_Allaka

this is the property name PR_MESSAGE_SIZE

also what message provider is your as there is a limitation on this

cheers

@Sandeep_Allaka

I think saving the email at some location like on local drive and then get that file size could be one of the solution for this.

Thanks All, I was able to get size only after passing these parameters $select = “subject” and $expand = singleValueExtendedProperties($filter=id eq ‘Integer 0x0E08’). It was not working when passed directly /users/{sharedMailbox}/messages/{messageId}?$expand = singleValueExtendedProperties($filter=id eq ‘Integer 0x0E08’)