This post is the seventh in a series of postings, containing examples of SharePoint WebParts that anybody can build all by themselves. To read all posts in this series, or to get started with the RSSBus WebPart, go here.
#7 – Search Email History
One of my good friends here recently asked me to give him an easy way to quickly bring up a list of email correspondence to and from a particular email address over the past 6 months. This way, if he is assisting someone on the telephone or email, he can quickly get up-to-date on what has gone on with this particular person in the recent past. In theory this is easy to do, but doing it in SharePoint would be difficult - well…it used to be. Now you can just copy and paste this template into an RSSBus Web Part and voila. :) Customize to your liking.
Step one is to make sure you have the RSSBus Web Part installed. See here for instructions.
Step two, make sure you have the Imap Connector installed. If you don’t already know the hostname/ip address of your IMAP mail server (e.g. MS Exchange) and a username/password to authenticate to that server, find that information next. This is the same information that you would enter into Outlook when configuring it to connect to your mail server.
Step three, add the RSSBus WebPart to your page, paste the following template into its source editor, and click “Apply”.
Step four is to specify your IMAP server and authentication credentials. If you’ve clicked “Apply” in the source editor of the web part, you should now see a new property appear in the properties editor of the web part in your browser. Under “Web Part Inputs”, you’ll see “server”, “email”, “password”, “mailbox” inputs. These inputs will need to be populated with the values corresponding to your IMAP server, mailbox name (e.g. “Inbox”), and account credentials. Optionally you can change the “months” and “sortcriteria” inputs to alter the output generated. By default, this web part will display messages to/from a specified email address in the past 6 months (the “months” input property) and then sort them by reverse-date (most recent first – the “sortcriteria” input).
After you have set these inputs appropriately, click “Apply” in the properties window and the page will reload. Enter an email address in the search box and click “Search”. The emails sent to or from that email address will be displayed inside the web part! Click on any one of those messages to load a plain text or html view of that email.
As always, you can customize the html in the template if you want, or leave it as is.
Advanced Tip – Note that the “sortcriteria” input expects a sort order formatted according to the IMAP Sort RFC (RFC 5256). Other common sort criteria: ARRIVAL, DATE, CC, FROM, SUBJECT, TO, SIZE. Any of those criteria can be preceeded with REVERSE as I’ve shown in my example. Similarly, the searchcriteria specified inside the template itself can also be modified in the format specified in the IMAPv4 RFC (Section 6.4.4 in RFC 3501).
See all posts in this series: 10 DIY SharePoint Web Parts.
Browse RSSBus Connectors.
Basic RSSBus Scripting Cheat Sheet.
Technorati Tags: SharePoint, RSSBus, WebPart, Exchange, IMAP, Email