Exemple #1
0
        /// <summary>
        /// Factory method to create and return the correct OutlookItem object (MailItem) for the given COM object.
        /// </summary>
        /// <param name="comObj"></param>
        /// <returns></returns>
        internal static OutlookItem ResolveType(object comObj)
        {
            if (ComWrapper.SupportsInterface(comObj, ComWrapper.GetMustSupport(typeof(MailItem))))
            {
                return(new MailItem(comObj));
            }

            throw new NotImplementedException("Unknown object when attempting to resolve Outlook item type.");
        }
Exemple #2
0
        /// <summary>
        /// Factory method to create and return the correct Sheet object (Worksheet or Chart) for the given COM object.
        /// </summary>
        /// <param name="comObj"></param>
        /// <returns></returns>
        internal static Sheet ResolveType(object comObj)
        {
            if (ComWrapper.SupportsInterface(comObj, ComWrapper.GetMustSupport(typeof(Worksheet))))
            {
                return(new Worksheet(comObj));
            }
            else if (ComWrapper.SupportsInterface(comObj, ComWrapper.GetMustSupport(typeof(Chart))))
            {
                return(new Chart(comObj));
            }

            throw new NotImplementedException("Unknown object when attempting to resolve sheet type.");
        }