コード例 #1
0
		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;
		}
コード例 #2
0
		private static string[] GetSmtpAddressCache(ADRawEntry person)
		{
			List<string> list = new List<string>(1);
			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 = smtpProxyAddress.ToString();
							if (!string.IsNullOrEmpty(text))
							{
								list.Add(text);
							}
						}
					}
				}
			}
			return list.ToArray();
		}
コード例 #3
0
            public override void Convert(ADRawEntry adObject, IStorePropertyBag contact)
            {
                Util.ThrowOnNullArgument(adObject, "adObject");
                Util.ThrowOnNullArgument(contact, "contact");
                object obj;

                if (adObject.TryGetValueWithoutDefault(ADRecipientSchema.GeoCoordinates, out obj))
                {
                    GeoCoordinates geoCoordinates = (GeoCoordinates)obj;
                    contact[ContactSchema.HomeLatitude]       = geoCoordinates.Latitude;
                    contact[ContactSchema.HomeLongitude]      = geoCoordinates.Longitude;
                    contact[ContactSchema.HomeLocationSource] = LocationSource.Contact;
                    if (geoCoordinates.Altitude != null)
                    {
                        contact[ContactSchema.HomeAltitude] = geoCoordinates.Altitude;
                    }
                    else
                    {
                        ADPersonToContactConverter.Tracer.TraceDebug(0L, "Deleting contact HomeAltitude property it is not found on AD GeoCoordinates property.");
                        contact.Delete(ContactSchema.HomeAltitude);
                    }
                    ADPersonToContactConverter.GeoCoordinatesConverter.locationUriConverter.Convert(adObject, contact);
                    return;
                }
                ADPersonToContactConverter.Tracer.TraceDebug(0L, "Deleting contact location properties since AD GeoCoordinates property not found.");
                contact.Delete(ContactSchema.HomeLatitude);
                contact.Delete(ContactSchema.HomeLongitude);
                contact.Delete(ContactSchema.HomeLocationSource);
                contact.Delete(ContactSchema.HomeAltitude);
                ADPersonToContactConverter.GeoCoordinatesConverter.locationUriConverter.Convert(adObject, contact);
            }
コード例 #4
0
        internal static bool GetOwnerId(ADRawEntry rawEntry, out ADABObjectId ownerId)
        {
            object obj;

            if (!rawEntry.TryGetValueWithoutDefault(ADGroupSchema.ManagedBy, out obj))
            {
                ownerId = null;
                return(false);
            }
            if (obj == null)
            {
                ownerId = null;
                return(true);
            }
            MultiValuedProperty <ADObjectId> multiValuedProperty = (MultiValuedProperty <ADObjectId>)obj;

            using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = multiValuedProperty.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    ADObjectId activeDirectoryObjectId = enumerator.Current;
                    ownerId = new ADABObjectId(activeDirectoryObjectId);
                    return(true);
                }
            }
            ownerId = null;
            return(true);
        }
コード例 #5
0
        public static string GetSipUri(ADRawEntry adEntry)
        {
            string text = null;
            object obj;

            if (adEntry.TryGetValueWithoutDefault(ADUserSchema.RTCSIPPrimaryUserAddress, out obj))
            {
                text = (obj as string);
            }
            object obj2;

            if (string.IsNullOrWhiteSpace(text) && adEntry.TryGetValueWithoutDefault(ADRecipientSchema.EmailAddresses, out obj2))
            {
                ProxyAddressCollection proxyAddressCollection = obj2 as ProxyAddressCollection;
                if (proxyAddressCollection != null)
                {
                    text = proxyAddressCollection.GetSipUri();
                }
            }
            return(text);
        }
コード例 #6
0
            public override void Convert(ADRawEntry adObject, IStorePropertyBag contact)
            {
                object obj;

                if (adObject.TryGetValueWithoutDefault(base.ADProperty, out obj))
                {
                    CountryInfo countryInfo = (CountryInfo)obj;
                    contact[base.ContactProperty] = countryInfo.LocalizedDisplayName.ToString();
                    return;
                }
                contact.Delete(base.ContactProperty);
            }
コード例 #7
0
            public override void Convert(ADRawEntry adObject, IStorePropertyBag contact)
            {
                Util.ThrowOnNullArgument(adObject, "adObject");
                Util.ThrowOnNullArgument(contact, "contact");
                object obj;

                if (adObject.TryGetValueWithoutDefault(base.ADProperty, out obj))
                {
                    contact[base.ContactProperty] = obj;
                    ADPersonToContactConverter.Tracer.TraceDebug <string, string, object>(0L, "Setting contact property {0} with value from AD property {1}. Value: {2}", base.ADProperty.Name, base.ContactProperty.Name, obj);
                    return;
                }
                ADPersonToContactConverter.Tracer.TraceDebug <string, string>(0L, "Deleting contact property {0} since AD property {1} not found.", base.ContactProperty.Name, base.ADProperty.Name);
                contact.Delete(base.ContactProperty);
            }
コード例 #8
0
            public override void Convert(ADRawEntry adObject, IStorePropertyBag contact)
            {
                Util.ThrowOnNullArgument(adObject, "adObject");
                Util.ThrowOnNullArgument(contact, "contact");
                object value;

                if (adObject.TryGetValueWithoutDefault(base.ADProperty, out value))
                {
                    contact[StoreObjectSchema.DisplayName] = (contact[ContactBaseSchema.DisplayNameFirstLast] = (contact[ContactBaseSchema.DisplayNameLastFirst] = value));
                    return;
                }
                ADPersonToContactConverter.Tracer.TraceDebug <string>(0L, "Deleting contact DisplayName properties since AD property {0} not found.", base.ADProperty.Name);
                contact.Delete(ContactBaseSchema.DisplayNameFirstLast);
                contact.Delete(ContactBaseSchema.DisplayNameLastFirst);
                contact.Delete(StoreObjectSchema.DisplayName);
            }
コード例 #9
0
        internal static bool GetId(ADRawEntry rawEntry, out ADABObjectId addressBookObjectId)
        {
            object obj;

            if (!rawEntry.TryGetValueWithoutDefault(ADObjectSchema.Id, out obj))
            {
                addressBookObjectId = null;
                return(false);
            }
            if (obj == null)
            {
                addressBookObjectId = null;
                return(true);
            }
            ADObjectId activeDirectoryObjectId = (ADObjectId)obj;

            addressBookObjectId = new ADABObjectId(activeDirectoryObjectId);
            return(true);
        }
コード例 #10
0
            public override void Convert(ADRawEntry adObject, IStorePropertyBag contact)
            {
                Util.ThrowOnNullArgument(adObject, "adObject");
                Util.ThrowOnNullArgument(contact, "contact");
                string text = null;
                object obj;

                if (adObject.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)
                            {
                                if (smtpProxyAddress.IsPrimaryAddress)
                                {
                                    text = smtpProxyAddress.SmtpAddress;
                                    break;
                                }
                                if (text == null)
                                {
                                    text = smtpProxyAddress.SmtpAddress;
                                }
                            }
                        }
                    }
                }
                if (text != null)
                {
                    contact[base.ContactProperty] = text;
                    return;
                }
                ADPersonToContactConverter.Tracer.TraceDebug <string>(0L, "Deleting contact property {0} since AD Object has no email addresses.", base.ContactProperty.Name);
                contact.Delete(base.ContactProperty);
            }
コード例 #11
0
        internal static bool GetWebPage(ADRawEntry rawEntry, out Uri webPageUri)
        {
            object obj;

            if (!rawEntry.TryGetValueWithoutDefault(ADRecipientSchema.WebPage, out obj))
            {
                webPageUri = null;
                return(false);
            }
            if (obj == null)
            {
                webPageUri = null;
                return(true);
            }
            string text = (string)obj;

            if (string.IsNullOrEmpty(text))
            {
                webPageUri = null;
                return(true);
            }
            return(Uri.TryCreate(text, UriKind.Absolute, out webPageUri) || true);
        }