W
Will
This was originally posted to microsoft.public.outlook.interop.
Using the Office XP PIA's, I've built an Outlook add-in with
a function that prompts the user to enter a new contact. The
function then moves the contact to a public folder. It does its
job well, but with a hitch.
When the user hits the Save & Close button on the contact
form, the form saves but doesn't close. The Save & Close
button becomes disabled. The user can hit the X to close
the window and the function continues.
How do I make Save & Close do as it promises?
Here is a brief example of my code (C#):
// ol = Microsoft.Outlook.Interop.Outlook
// globalContactsFolder = a MAPIFolder object.
private void addContact()
{
if (app!=null)
ol.ContactItem newContact = (ol.ContactItem)
app.CreateItem(ol.OlItemType.olContactItem);
newContact.Display(true); // true=modal
newContact.Close(ol.OlInspectorClose.olSave);
if (newContact!=null)
{
ol.ContactItem contactForGlobal = (ol.ContactItem)
newContact.Copy();
contactForGlobal.Move(globalContactsFolder);
}
newContact.Delete();
//...
}
What can I do?
Thanks!!
Will
Using the Office XP PIA's, I've built an Outlook add-in with
a function that prompts the user to enter a new contact. The
function then moves the contact to a public folder. It does its
job well, but with a hitch.
When the user hits the Save & Close button on the contact
form, the form saves but doesn't close. The Save & Close
button becomes disabled. The user can hit the X to close
the window and the function continues.
How do I make Save & Close do as it promises?
Here is a brief example of my code (C#):
// ol = Microsoft.Outlook.Interop.Outlook
// globalContactsFolder = a MAPIFolder object.
private void addContact()
{
if (app!=null)
ol.ContactItem newContact = (ol.ContactItem)
app.CreateItem(ol.OlItemType.olContactItem);
newContact.Display(true); // true=modal
newContact.Close(ol.OlInspectorClose.olSave);
if (newContact!=null)
{
ol.ContactItem contactForGlobal = (ol.ContactItem)
newContact.Copy();
contactForGlobal.Move(globalContactsFolder);
}
newContact.Delete();
//...
}
What can I do?
Thanks!!
Will