Get Outlook Mail Message-How can I copy body and paste with values?

I’m struggling with paste only values to excel. Could you please give me some help?

When I copy Body of e-mail, all links are converted to URL itself.
Is there another way that I can copy text as it is?
[Initial Body Contents]


The switch in the UQ-KR-1100-Homplus Asiad - switch|01||55471133b39e4219024e08d8d6fad45a|9026775cbc244a4eb109baee1f2b0f50|0|0|637495720103311494|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=qrdj6nojoxQSC5dcy2lRXvESWwt2YDoPk902%2BrHP1iI%3D&reserved=0 network have become unreachable from the Meraki cloud.

UQ-KR-1100-CoreSW2|01||55471133b39e4219024e08d8d6fad45a|9026775cbc244a4eb109baee1f2b0f50|0|0|637495720103321487|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=BdNa1IDU3gVEiWzdIYFZBskEuScLpMgOFS%2BPmWueYDo%3D&reserved=0 0c:8d:db:2d:36:5c 03:11 PM KST on Feb 22
UQ-KR-1100-CoreSW1|01||55471133b39e4219024e08d8d6fad45a|9026775cbc244a4eb109baee1f2b0f50|0|0|637495720103321487|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=WXCQflzEiMnqNmzhT%2BrfS%2FVTNgjRzV9s4gjR%2F9kJKtw%3D&reserved=0 0c:8d:db:2e:98:7c 03:11 PM KST on Feb 22

  • Cisco Meraki

This email was automatically generated; please do not reply.
You can change the alert delivery settings|01||55471133b39e4219024e08d8d6fad45a|9026775cbc244a4eb109baee1f2b0f50|0|0|637495720103331479|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=tBKfBnFewf30ROBCLshf0x8I89TaMPzoRSzVF1Pfkkg%3D&reserved=0 for this network.



@Dorothy_lee Maybe there is another method to effectively remove the Hyperlinks in the Body, but However we can try with using Regex Replace to Replace the <https: … > pattern with an Empty String like the Below Expression.

strBody = System.Text.RegularExpressions.Regex.Replace(item.Body,"(?=\<https:).[^>]*>","")

Where item is your Mail Mesage.

Can you check and let us know if you’re able to remove the needed URL’s with the above expression


@supermanPunch wow… Thank you so much!! It’s working properly and exactly what I meant!! :slight_smile:
If possible could you please explain the details on above code…?
Also, I’d like to delete ‘Yellow Remarked’. Is it possible to add additional condition on above code?

@Dorothy_lee Understanding the Pattern of the Input and the required/expected output that you needed, I came to the conclusion that all the Hyperlinks/ URL’s have the pattern https:... and so if there is a pattern we could introduce a Logic either by using a String Manipulation or Regex Replace, Since the input was also a String.

The Expression also does the same thing.

Regex.Replace is a Method that allows us replace a pattern in a String with any other String value of our Choice. In the Above expression I am replacing the occurrences of the Pattern with an Empty String, Leading to the Removal of URL’s

If we can Hover over the Replace Method you’ll get to know the Syntax:

To work on producing the Pattern I have made use of the, Link Below:
regex101: build, test, and debug regex

Also you should definitely go through the below post if you are not familiar with regex yet :

1 Like

@Dorothy_lee Arriving to the next query that you have mentioned, You want to also remove the Yellow Highlighted Mark. So can you tell me if that also follows the same pattern throughout different data/mails that you will be receiving ?

@supermanPunch Yes, Yellow Highlighted Mark is always followed with the same pattern throughout all other mails that I received!

@Dorothy_lee Is the last part constant always for all the mails? i.e “You can change the Alert Delivery Settings for this Network”

@supermanPunch Yes, “You can change the Alert Delivery Settings for this Network” is always the last part of message !

@Dorothy_lee After you have used the Regex Replace to replace the URL’s, then we can make use of the Regex Replace again to replace the last part that you do not need that accepts the pattern of hyphen (-) being the last hyphen present in the body to the end statement.

You can try with the below expression and let us know if it works for all of your input cases.

strBody = System.Text.RegularExpressions.Regex.Replace(strBody,"-+[^-]*-*(?!.*-)(?<=You can change the alert delivery settings).*","")

Where strBody is a String value which should be used after the regex replace of the URL’s

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.