I\'m working on a database project and I need to create Outlook 2007 plugin that saves the current previewed message into my database.
Can someone give me a step-by-step
If you just want to learn and understand how to do it, just google for Delphi Outlook addin (I'm pretty sure "addin" should give you much more relevant results than "plugin" in this context) and you should come up with a number of slightly dated but still formally correct sample addins, e.g. the Babelfish addin from Dmitry Streblechenko (which is no longer useful because the web service it relies on no longer exists but still shows the basics) or the sample addin from Paul Qualls (which is unfortunately no longer available from the original site). There's also a mail whitelister addin available with complete source, but I haven't looked at that yet.
However, sooner or later you will want to start using a proven framework like ADX, especially if your addin is going to be used outside your company. We develop a shareware addin in Delphi and about 75% of the code in the addin is just there to provide support for the various versions of Outlook (especially Outlook XP) and different setups (most notably the option to use Word for message editing has been a major table-biter for us).
Another factor is having to constantly work around the stupid OOM security model. You're pretty much busted without Redemption or Outlook Security Manager there. Redemption especially could not be recommended highly enough, not only for avoiding the security prompts but also for simplifying a plethora of tedious routine tasks with a solid, easy-to-use framework of its own.
[Addition:] We did start out with our own home-grown framework and all was well with it until the number of users and with them the number of different configurations to support exploded. We switched to ADX about a year ago and never looked back. Using Redemption was a no-brainer right from the beginning though - it was either that or spend months learning Extended MAPI before we even got started (you do still tend to pick that up much easier as you go along once Redemption has guided you over the first few hurdles).
BTW: Another indispensable tool for any self-respecting addin developer (regardless of programming language used) is OutlookSpy. This will really allow you to see (and manipulate) what goes on inside Outlook (and to some extent Exchange) as it happens and give you a much better understanding of what your addin will have to do in order to achieve the effect you want.