Mitdasein in the experience of encountering the customer in our common having been cast into the opening of beyng

Thursday, March 24, 2005

C# Program CopyOutlookContactsToBcm

// CopyOutlookContactsToBcm.cs
using System;
using Microsoft.Office.Interop.Outlook;

namespace BCMOutlook
{
class CopyOutlookContactsToBcm
{
[STAThread]
static void Main()
{
Application app = new Application();
NameSpace ns = app.GetNamespace("MAPI");
Folders messageStores = ns.Session.Folders;
MAPIFolder bcmFolder = messageStores["Business Contact Manager"];
MAPIFolder bcmContactsFolder = bcmFolder.Folders["Business Contacts"];
MAPIFolder olContactsFolder = ns.GetDefaultFolder(OlDefaultFolders.olFolderContacts);

foreach (ContactItem ci in olContactsFolder.Items)
{
ContactItem newContact = (ContactItem)bcmContactsFolder.Items.Add("IPM.Contact.Iris.Contact");
foreach (ItemProperty ip in ci.ItemProperties)
{
try
{
newContact.ItemProperties[ip.Name].Value = ip.Value;
}
catch (System.Exception) {}
}
newContact.Save();
}
}
}
}

0 Comments:

Post a Comment

<< Home