Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Business Contact Manager / March 2008

Tip: Looking for answers? Try searching our database.

Importing from Access with custom code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad Covell - 04 Mar 2008 19:19 GMT
I'm currently developing an application that will import account and contact
information into BCM from an Access database. I tried originally to import
using the built-in tool but there are some items like the ability to link
contact information within Access to the account being imported. Along with
some other fields that didn't really map well, so I started on a project to
do a custom import.

I am currently able to import a lot of the information the samples provided
on msdn were great. However, I'm trying to import the Account Number and
Active properties http://msdn2.microsoft.com/en-us/library/bb267853.aspx
But the following doesn't have an AccountNumber property.

Am I missing something or shouldn't the AccountNumber and Active property
work? Is there a way around this?

Thanks
Brad

//account object is a DictionaryEntry that I populated with the Access
database information.

Outlook.ContactItem newAccount =
(Outlook.ContactItem)accounts.Items.Add("IPM.Contact.BCM.Account");

newAccount.FullName = account["accountname"]; //works

newAccount.FileAs = account["accountname"]; //works

newAccount.AccountNumber = account["accountnumber"];  //doesn't like this,
even though it's documented that this should work, same thing for Active

newAccount.Active = true; //fails

newAccount.OfficeLocation = account["officelocation"]; //works
Luther - 05 Mar 2008 04:47 GMT
> I'm currently developing an application that will import account and contact
> information into BCM from an Access database. I tried originally to import
[quoted text clipped - 30 lines]
>
> newAccount.OfficeLocation = account["officelocation"]; //works

I bet because they're in the ItemProperties array.

Welcome to the Outlook Object Model!
Brad Covell - 05 Mar 2008 12:35 GMT
Luther,,

I have tried setting newAccount.ItemProperties["Account Number"].Value and
newAccount.ItemProperties["Active"].Value but it throws an exception, object
not set to an instance of an object.

I don't think they are in the ItemProperties array. Is this an issue with
the object model? if so, is there any way around this? Can you confirm this?
The other import code works great it's just these last few properties that
I'm missing because their properties don't seem to be active in the object
model.

I can send my import application if you'd like to see the issue. Is this
something I should open a case for if it is an issue?

Thanks
Brad

On Mar 4, 11:19 am, "Brad Covell" <brad.cov...@vai.org> wrote:
> I'm currently developing an application that will import account and
> contact
[quoted text clipped - 34 lines]
>
> newAccount.OfficeLocation = account["officelocation"]; //works

I bet because they're in the ItemProperties array.

Welcome to the Outlook Object Model!
Brad Covell - 05 Mar 2008 16:18 GMT
Well I figured it out. Here is the solution. Not that obvious since Account
Number isn't a user created field. I would have expected it to be off of the
newAccount object or in the ItemProperties collection.

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();

}

On Mar 4, 11:19 am, "Brad Covell" <brad.cov...@vai.org> wrote:
> I'm currently developing an application that will import account and
> contact
[quoted text clipped - 34 lines]
>
> newAccount.OfficeLocation = account["officelocation"]; //works

I bet because they're in the ItemProperties array.

Welcome to the Outlook Object Model!
Luther - 06 Mar 2008 17:14 GMT
> Well I figured it out. Here is the solution. Not that obvious since Account
> Number isn't a user created field. I would have expected it to be off of the
[quoted text clipped - 56 lines]
>
> - Show quoted text -

Good stuff.

I just blogged the VBS code for creating the Active property before
setting its value, so I can find it the next time something like this
comes up.

http://beyng.blogspot.com/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.