开发者

Sync Microsoft Outlook with my own data?

Using VB.Net, I need 开发者_如何学Cto read data from a Microsoft Outlook 2007 PST file and an external database, and sync the two sources.

Past posts on SO mention Microsoft.Office.Interop.Outlook. I was wondering if VB.Net developers had successfully used this to work with Outlook, or if there were other solutions I should try instead.

Thank you.


If you really talk about "synchronization" then you should take a look at Microsoft Sync Framework. http://msdn.microsoft.com/en-us/sync/default

This framework helps out with everything that relates to synchronization, what happens when same data has changed in both places, and so on. And they have lots of "providers", for example Outlook are one "provider" that you can use to synk items between your own data and outlook.

Contact Synchronization Sample (C#)

From msdn:
This sample shows how custom providers can be created to synchronize content between disparate data sources. In this sample we will synchronize Contacts between Microsoft Outlook, Vista Contacts and VCard files. A key aspect of this demo is the data mapping capabilities which enables disparate data sources and data types to be mapped appropriately through the Sync Framework

http://archive.msdn.microsoft.com/sync/Release/ProjectReleases.aspx?ReleaseId=613

Or the good old way...:
If you just want to add some contact or meeting then the old office interopt is good enough, here are an quick example, 11 rows of code to add a contact:

    Dim OutlookApp As Outlook.Application = New Outlook.Application
    Dim OutlookNameSpace As Outlook.NameSpace = OutlookApp.GetNamespace("MAPI")
    OutlookNameSpace.Logon()

    Dim Contacts As Outlook.MAPIFolder = OutlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)

    Dim newContact As Outlook.ContactItem = OutlookApp.CreateItem(Outlook.OlItemType.olContactItem)
    newContact.FullName = "Stefan Karlsson"
    newContact.Email1Address = "myemail@mail.com"
    newContact.BusinessHomePage = "www.example.com"
    newContact.Save()

    OutlookApp.Logoff()
    OutlookApp.Quit()

(You have to add reference to Microsoft.Office.Interop.Outlook and add this imports to your code for the example to work)

Imports Microsoft.Office.Interop


You may also find helpful a free Outlook add-in used for synchronizing Outlook and Gmail accounts and contacts: http://scand.com/products/outlook4gmail/index.html. I found it a week ago and have been using ever since for Outlook 2007, though it can be used for Outlook 2010 as well. The features are really useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜