private static HashSet<string> GetEmailAddresses(ADRawEntry person) { HashSet<string> hashSet = new HashSet<string>(); object obj; if (person.TryGetValueWithoutDefault(ADRecipientSchema.EmailAddresses, out obj)) { ProxyAddressCollection proxyAddressCollection = obj as ProxyAddressCollection; if (proxyAddressCollection != null) { foreach (ProxyAddress proxyAddress in proxyAddressCollection) { SmtpProxyAddress smtpProxyAddress = proxyAddress as SmtpProxyAddress; if (smtpProxyAddress != null) { string text = ContactInfoForLinking.CanonicalizeEmailAddress(smtpProxyAddress.SmtpAddress); if (!string.IsNullOrEmpty(text)) { hashSet.Add(text); } } } } } return hashSet; }
protected ContactInfoForLinking(PropertyBagAdaptor propertyBag) : this(propertyBag.GetValueOrDefault <bool>(ContactSchema.Linked, false), propertyBag.GetValueOrDefault <PersonId>(ContactSchema.PersonId, null), ContactInfoForLinking.GetPropertyAsHashSet <PersonId>(propertyBag, ContactSchema.LinkRejectHistory, new HashSet <PersonId>()), propertyBag.GetValueOrDefault <Guid?>(ContactSchema.GALLinkID, null), propertyBag.GetValueOrDefault <byte[]>(ContactSchema.AddressBookEntryId, null), propertyBag.GetValueOrDefault <GALLinkState>(ContactSchema.GALLinkState, GALLinkState.NotLinked), propertyBag.GetValueOrDefault <string[]>(ContactSchema.SmtpAddressCache, Array <string> .Empty), propertyBag.GetValueOrDefault <bool>(ContactSchema.UserApprovedLink, false)) { this.ItemId = propertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null); this.EmailAddresses = ContactInfoForLinking.GetEmailAddresses(propertyBag); this.GivenName = propertyBag.GetValueOrDefault <string>(ContactSchema.GivenName, string.Empty); this.Surname = propertyBag.GetValueOrDefault <string>(ContactSchema.Surname, string.Empty); this.DisplayName = propertyBag.GetValueOrDefault <string>(StoreObjectSchema.DisplayName, string.Empty); this.PartnerNetworkId = propertyBag.GetValueOrDefault <string>(ContactSchema.PartnerNetworkId, string.Empty); this.PartnerNetworkUserId = propertyBag.GetValueOrDefault <string>(ContactSchema.PartnerNetworkUserId, string.Empty); this.IMAddress = ContactInfoForLinking.CanonicalizeEmailAddress(propertyBag.GetValueOrDefault <string>(ContactSchema.IMAddress, string.Empty)); this.IsDL = ObjectClass.IsOfClass(propertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, string.Empty), "IPM.DistList"); }
private static HashSet <string> GetEmailAddresses(PropertyBagAdaptor propertyBag) { HashSet <string> hashSet = new HashSet <string>(); foreach (StorePropertyDefinition propertyDefinition in ContactSchema.EmailAddressProperties) { string text = ContactInfoForLinking.CanonicalizeEmailAddress(propertyBag.GetValueOrDefault <string>(propertyDefinition, string.Empty)); if (!string.IsNullOrEmpty(text)) { hashSet.Add(text); } } return(hashSet); }