Ejemplo n.º 1
0
 internal static bool VerifyExtendedPropertyInfoAndExtendedPropertyDefinition(ExtendedPropertyInfo epi, ExtendedPropertyDefinition epd)
 {
     if (epi == null && epd == null)
     {
         return(true);
     }
     if (epi != null != (epd != null))
     {
         return(false);
     }
     if (epi.GetMapiPropertyType() != epd.MapiType)
     {
         return(false);
     }
     if (epi.PropertyTagId != null && epi.PropertyTagId != null && epi.PropertyTagId.Equals(epd.Tag))
     {
         return(true);
     }
     if (epi.PropertySetId != Guid.Empty)
     {
         if (!string.IsNullOrEmpty(epi.PropertyName) && string.Compare(epi.PropertyName, epd.Name, StringComparison.OrdinalIgnoreCase) == 0)
         {
             return(true);
         }
         if (epi.PropertyId != null && epi.PropertyId != null && epd.Id != null && epd.Id != null && epi.PropertyId.Equals(epd.Id))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        internal static ExtendedPropertyDefinition ConvertExtendedPropertyInfoToExtendedPropertyDefinition(ExtendedPropertyInfo extendedPropertyInfo)
        {
            MapiPropertyType mapiPropertyType = extendedPropertyInfo.GetMapiPropertyType();

            if (extendedPropertyInfo.PropertyTagId != null && extendedPropertyInfo.PropertyTagId != null)
            {
                return(new ExtendedPropertyDefinition(extendedPropertyInfo.PropertyTagId.Value, mapiPropertyType));
            }
            if (extendedPropertyInfo.PropertySetId != Guid.Empty)
            {
                if (!string.IsNullOrEmpty(extendedPropertyInfo.PropertyName))
                {
                    return(new ExtendedPropertyDefinition(extendedPropertyInfo.PropertySetId, extendedPropertyInfo.PropertyName, mapiPropertyType));
                }
                if (extendedPropertyInfo.PropertyId != null && extendedPropertyInfo.PropertyId != null)
                {
                    return(new ExtendedPropertyDefinition(extendedPropertyInfo.PropertySetId, extendedPropertyInfo.PropertyId.Value, mapiPropertyType));
                }
            }
            throw new ArgumentException(string.Format("Could not convert {0} to ExtendedPropertyDefinition", extendedPropertyInfo.ToString()));
        }