S
Sam Jost
Hi,
I'm writing a little c# program to import contacts into outlook. It is
simple enough to add a new contact like this:
Outlook.ContactItem newItem =
(Outlook.ContactItem)outlookApp.CreateItem(Outlook.OlItemType.olContactItem);
newItem.LastName= "Jost";
newItem.FirstName= "Sam";
newItem.Close(Outlook.OlInspectorClose.olSave);
this code snipped does work nicely, even for a few hundrets of contacts.
My problem is, I'd like to add these contacts not in the standard folder but
in some other. When I try using Move() to put the contacts into the
destination folder like this it does work for about 200 contacts before I
get an exception
Outlook.ContactItem newItem =
(Outlook.ContactItem)outlookApp.CreateItem(Outlook.OlItemType.olContactItem);
newItem.LastName= "Jost";
newItem.FirstName= "Sam";
newItem.Move(MyOutlookKontaktFolder);
newItem.Close(Outlook.OlInspectorClose.olDiscard);
Error : Client-Exception.
at Outlook._ContactItem.Move(MAPIFolder DestFldr)
at OutlookExporter.Class1.Sync() in
c:\pw\outlookexporter\outlookexporter.cs:line 197
And the last contact will be in the default folder instead of the
destination folder.
My guess is I'm using Move() incorrectly, or miss something like Dispose()
(that I cant find on these classes) so I got a memory leak or something.
Can anyboy help me here, or point me somewhere I can get help?
thanks,
Sam
I'm writing a little c# program to import contacts into outlook. It is
simple enough to add a new contact like this:
Outlook.ContactItem newItem =
(Outlook.ContactItem)outlookApp.CreateItem(Outlook.OlItemType.olContactItem);
newItem.LastName= "Jost";
newItem.FirstName= "Sam";
newItem.Close(Outlook.OlInspectorClose.olSave);
this code snipped does work nicely, even for a few hundrets of contacts.
My problem is, I'd like to add these contacts not in the standard folder but
in some other. When I try using Move() to put the contacts into the
destination folder like this it does work for about 200 contacts before I
get an exception
Outlook.ContactItem newItem =
(Outlook.ContactItem)outlookApp.CreateItem(Outlook.OlItemType.olContactItem);
newItem.LastName= "Jost";
newItem.FirstName= "Sam";
newItem.Move(MyOutlookKontaktFolder);
newItem.Close(Outlook.OlInspectorClose.olDiscard);
Error : Client-Exception.
at Outlook._ContactItem.Move(MAPIFolder DestFldr)
at OutlookExporter.Class1.Sync() in
c:\pw\outlookexporter\outlookexporter.cs:line 197
And the last contact will be in the default folder instead of the
destination folder.
My guess is I'm using Move() incorrectly, or miss something like Dispose()
(that I cant find on these classes) so I got a memory leak or something.
Can anyboy help me here, or point me somewhere I can get help?
thanks,
Sam