示例#1
0
        public static IContactItem CreateContactItem(ContactManagerBase mgr, object baseContact)
        {
            try
            {
                mgr.ToggleSecurityWarning(true);
                IContactItem newItem = null;
                if (mgr is OutlookContactManager)
                {
                    OutlookContactManager cmgr = (OutlookContactManager)mgr;

                    if (baseContact == null)
                    {
                        baseContact = cmgr.OutlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olContactItem) as Microsoft.Office.Interop.Outlook.ContactItem;
                    }
                    newItem = new OutlookContactItem((Microsoft.Office.Interop.Outlook.ContactItem)baseContact);
                    //newItem.BaseContact = baseContact;
                }
                return(newItem);
            }
            finally
            {
                mgr.ToggleSecurityWarning(false);
            }
        }
示例#2
0
        public static IContactItem CreateContactItem(ContactManagerBase mgr, object baseContact)
        {
            try
            {
                mgr.ToggleSecurityWarning(true);
                IContactItem newItem = null;
                if (mgr is OutlookContactManager)
                {
                    OutlookContactManager cmgr = (OutlookContactManager)mgr;

                    if (baseContact == null)
                    {
                        baseContact = cmgr.OutlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olContactItem) as Microsoft.Office.Interop.Outlook.ContactItem;
                    }
                    newItem = new OutlookContactItem((Microsoft.Office.Interop.Outlook.ContactItem)baseContact);
                    //newItem.BaseContact = baseContact;
                }
                return newItem;
            }
            finally
            {
                mgr.ToggleSecurityWarning(false);
            }
        }