This is the heart of my import tool. It doesn't import or create projects but I imagine the process is very similar. Probably instead of the line "Outlook.Folder accounts = (Outlook.Folder)bcmRootFolder.Folders["Accounts"]" you may want to use something like "Outlook.Folder projects = (Outlook.Folder)bcmRootFolder.Folders["projects"]" or whatever the projects folder is named. And then create a Outlook.ContactItem newProject = (Outlook.ContactItem)projects.Items.Add("IPM.Contact.BCM.Project"). Something like that, you may need to play around with it to figure out exactly how to create that project object but once you get it you should be able to set properties on it like I've done with the account object below.
Outlook.ApplicationClass _app = new Outlook.ApplicationClass();
Outlook.Application olApp = (Outlook.Application)_app;
Outlook.NameSpace olNameSpace = _app.GetNamespace("MAPI");
Outlook.Folders folders = olNameSpace.Session.Folders;
Outlook.Folder bcmRootFolder = (Outlook.Folder)folders["Business Contact Manager"];
Outlook.Folder accounts = (Outlook.Folder)bcmRootFolder.Folders["Accounts"];
Outlook.UserProperty userProp;
foreach (StringDictionary account in accountList)
{
Outlook.ContactItem newAccount = (Outlook.ContactItem)accounts.Items.Add("IPM.Contact.BCM.Account");
newAccount.FullName = account["accountname"].Trim();
newAccount.FileAs = account["accountname"].Trim();
newAccount.OfficeLocation = account["officelocation"].Trim();
newAccount.Save();
//populate the account number
if (newAccount.UserProperties["Account Number"] == null)
{
userProp = newAccount.UserProperties.Add("Account Number", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, false, false);
userProp.Value = account["accountnumber"].Trim();
}
//populate the active flag
if (newAccount.UserProperties["Active"] == null)
{
userProp = newAccount.UserProperties.Add("Active", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olYesNo, false, false);
userProp.Value = account["inactive"].Trim();
}
//populate the type of business
if (newAccount.UserProperties["Type of Business"] == null)
{
userProp = newAccount.UserProperties.Add("Type of Business", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, false, false);
userProp.Value = account["contacttypeid"].Trim();
}
//populate the business address
if (account["address2"].Trim() != string.Empty)
{
StringBuilder sbBusinessAddressStreet = new StringBuilder();
sbBusinessAddressStreet.AppendLine(account["address1"].Trim());
sbBusinessAddressStreet.AppendLine(account["address2"].Trim());
newAccount.BusinessAddressStreet = sbBusinessAddressStreet.ToString();
}
else
{
newAccount.BusinessAddressStreet = account["address1"].Trim();
}
newAccount.BusinessAddressCity = account["city"].Trim();
newAccount.BusinessAddressState = account["state"].Trim();
newAccount.BusinessAddressPostalCode = account["zipcode"].Trim();
newAccount.BusinessAddressCountry = account["country"].Trim();
//add phone and fax info
newAccount.BusinessTelephoneNumber = account["companyphone"].Trim();
newAccount.BusinessFaxNumber = account["faxnumber"].Trim();
newAccount.WebPage = account["webpageaddress"].Trim();
//custom user defined field
}
if (newAccount.UserProperties["Business Card On File"] == null)
{
userProp = newAccount.UserProperties.Add("Business Card On File", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olYesNo, false, false);
userProp.Value = account["cardonfile"].Trim();
}
//add other information
newAccount.Body = account["comments"].Trim();
newAccount.Save();
Showing posts with label Outlook. Show all posts
Showing posts with label Outlook. Show all posts
Tuesday, July 8, 2008
Monday, June 9, 2008
Hide "click here to enable instant search" in Outlook
You can turn off the message in Outlook by doing the following:
In Outlook go to Tools->Options->Other->Advanced
Once there remove the check next to the option: S"how prompts to install WDS"
BCM (Business Contact Manager) Local Database Location
If you are using Outlook Business Contact Manager and wonder where the local database is stored on your machine look no further than here in Windows XP:
C:\Documents and Settings\{username}\Local Settings\Application Data\Microsoft\Business Contact Manager
Should be a .ldf and an .mdf file for the database that looks similar to this:
{DatabaseName}OutlookDefaultProfile_offline
C:\Documents and Settings\{username}\Local Settings\Application Data\Microsoft\Business Contact Manager
Should be a .ldf and an .mdf file for the database that looks similar to this:
{DatabaseName}OutlookDefaultProfile_offline
Subscribe to:
Posts (Atom)