///<Summary>
        /// Get Custom Properties
        ///</Summary>
        /// <param name="msg"></param>
        public static Dictionary <long, NamedMapiProperty> GetCustomProperties(this MapiMessage msg)
        {
            var customProperties = new Dictionary <long, NamedMapiProperty>();

            // 0x00008540 is equivalent of MapiNamedPropertyId.PidLidPropertyDefinitionStream
            long tag = GetTagFromNamedProperty(0x00008540, msg);

            if (tag > 0)
            {
                byte[]        data  = msg.TryGetPropertyData(tag);
                List <string> names = GetCustomPropertiesNames(data);

                foreach (var name in names)
                {
                    long tagCustomProp = GetTagFromNamedProperty(name, msg);
                    if (tagCustomProp > 0)
                    {
                        MapiProperty customProp = msg.Properties[tagCustomProp];
                        if (customProp != null)
                        {
                            customProperties[tagCustomProp] = new NamedMapiProperty(name, customProp);
                        }
                    }
                }
            }

            return(customProperties);
        }