About Me

My photo
I'm currently the CTO for Hedgehog Technology a business dedicated to delivering Cloud based productivity solutions in Logistics

Tuesday, October 02, 2007

Outlook Add-in and SharePoint: Getting Started

As some of you might know I was involved with the CA Visual Objects community in a previous life. "VO" as we passionately call it is a Win-32 bit environment with good OO-support and an xBase (Clipper) background, somewhat like Visual Foxpro. And soon there will even be a .net version called Vulcan!

In the VO forum I was requested to write some articles about how to save e-mail into SharePoint. So I've done some research and came up with a few really basic articles that explain how to create an Add-in for Outlook 2007 using VSTO 2005 SE, how to save items to SharePoint, how to add context menu items etc. All in C#.

The articles are posted here: http://www.softwareobjectives.com.au/VoConversion/Article%20Archive/Forms/HomePage.aspx (this is Part I and II, more to follow soon). The objective of the articles is to keep the code limited to a few lines, each time expanding a bit more. The first deals with how to hook up event handlers and save send mail to SharePoint automatically, the second how to add a context menu item and save incoming mail manually. Next I will add some info on how to process multiple Items, introducing the new Table/SQL queries for Outlook, add dialogs on Save and set item properties so that mail can be 'tagged' for the correct client, staffmember, order or whatever kind of context you would like to add.

If you have any questions or requests of other functionality you would like to know about just leave a comment.

8 comments:

Unknown said...

Ed,

Thanks for the great article. My question is what if we don't implement sharepoint and instead want to save the message out to a directory. Is there a way to do so? if there is, is there a way to browse and view the content of that directory right within outlook as if it one of the folders created under the Inbox? Thanks!

Ed Richard said...

Sure, just call the Item.SaveAs method with a normal filename. Although for stuff like email I really recommend using SharePoint as it gives youmuch more flexibility for organising and filtering/viewing contents than a regular Directory. (And SharePoint (WSS) is a free component of Windows 2003 server!).

When you go SharePoint (WSS 3.0) you automatically get the capability to connect a Document Library (== Directory) to Outlook 2007, which displays the content of the library as a node in the left pane.
This also sync's automatically so it enables users to take files off-line when they travel.

Ed

Unknown said...

we do have sharepoint server and did try that process. The problem is that the need of accessing 80 GB worth of email is the problem when sync automatically. Each time a structure of these 80 GB changes, Office 2007 takes a long time to sync back and normally taking up all the hardware resources, too. What's your thoughts on that?

Thanks!

1and1 customer said...

the link seems not available. can you please verify and post again? thanks.

Ed Richard said...

Sorry David, our site is moving to a new server, today as it happens...

If you send me an email at Ed@Softwareobjectives.com.au I can email you the files

Ed Richard said...

It's back on-line now David. Please let me know if you have any suggestions for me to add.

Ed

Tim said...

Hey Ed,

Thanks for your Fantastic posts! they have really made it easy for me to understand how to get this up and running.

What I dont understand is, how can I profile the email before it gets saved to sharepoint? How do I save metadata into their relevant columns onto sharepoint using the saveas feature?

Thanks!
Tim from Perth.

Ed Richard said...

Hi Tim,

Glad it helps.

Updating the metadata is the 'tricky bit' I've solved that generically because the 'problem' obviously occurs in multiple places, for example also when you have LOB-applications that need to set/get SharePoint properties on documents stored in SharePoint.

So, what I have is a Web Service running on my server that can deal with these things. You'll see that once you have a Web Service, you'll start using it for all kinds of things.

The reason I use a Web Service is that in the server side code I have full access to the SharePoint object model and that's much more productive (for me at least) than tring to solve everything using the SharePoint Web Services, which of course you could use as well.

The client side code becomes very simple:

WssDocumentService.Service oSrvcs = new WssDocumentService.Service();

oSrvcs.cUpdateDocumentItemByFName(cSite, cLib, EntryID + ".msg", "CFILE", cCFile);

As you can see the method takes the filename, and in this case updates a field called CFILE, I pass in all the details it needs such as Site and Document library.

Let me know if you need more info on the Web Service side of things, it might be best if I do a seperate blog post on that.

Ed