Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
955 views
in Technique[技术] by (71.8m points)

regex - Regular expression credit card search using Exchange Web Services?

I want to write a little app to scan employee's mailboxes and cleanse them of credit card numbers (people sometimes email them in unfortunately!)

I've already got something that does this in Outlook, but it means setting up shared mailboxes and is a bit of a hassle. It seems that Exchange-side would be the best option.

I'd like to use EWS, but it's search options are a bit limited (even if I want to get a set of potential candidate emails, I think I need 10 different filters to return emails with the numbers 0-9 in their body... and then to confirm/deny using regular expression in code!)

Anyway, if anyone can think of a nice way to do this using EWS, that would be most excellent!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Unfortunately, Regex searches are not possible with EWS. You'll need to pull the messages from the server and perform the search on the client.

There is one thing you can do to speed it up: Instead of polling each mailbox over and over again, use the SyncFolderItems (http://www.infinitec.de/post/2009/06/07/Processing-items-in-an-Exchange-folder-using-EWS-Managed-API.aspx).

Use the cookie you get back in subsequent calls. Obviously, you need to store the cookies somewhere, but a simple database table with the two columns FolderId and cookie is sufficient.

This way you'll only process new/changed items since the last call.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...