public static PropTag Lookup(ADPropertyDefinition adProperty)
        {
            NspiSchemaProperties.Initialize();
            PropTag result;

            if (NspiSchemaProperties.ldapNameToPropTagMap.TryGetValue(adProperty.LdapDisplayName, out result))
            {
                return(result);
            }
            return(PropTag.Null);
        }
        private static void Initialize()
        {
            if (NspiSchemaProperties.isInitialized)
            {
                return;
            }
            IConfigurationSession configurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.SessionSettingsFactory.Default.FromRootOrgScopeSet(), 98, "Initialize", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\nspi\\NspiSchemaProperties.cs");
            ADPagedReader <ADSchemaAttributeObject>   adpagedReader = configurationSession.FindPaged <ADSchemaAttributeObject>(configurationSession.SchemaNamingContext, QueryScope.SubTree, NspiSchemaProperties.AllMapiAttributesFilter, null, 0);
            Dictionary <int, ADSchemaAttributeObject> dictionary    = new Dictionary <int, ADSchemaAttributeObject>(500);

            foreach (ADSchemaAttributeObject adschemaAttributeObject in adpagedReader)
            {
                NspiSchemaProperties.Tracer.TraceDebug(0L, "Property 0x{0:X4}: {1} {2} {3} {4} {5}", new object[]
                {
                    adschemaAttributeObject.MapiID,
                    adschemaAttributeObject.LdapDisplayName,
                    adschemaAttributeObject.DataSyntax,
                    adschemaAttributeObject.IsSingleValued ? "Singlevalue" : "Multivalue",
                    (adschemaAttributeObject.LinkID == 0) ? "!Link" : adschemaAttributeObject.LinkID.ToString(),
                    adschemaAttributeObject.IsMemberOfPartialAttributeSet ? "GC" : "!GC"
                });
                int mapiID = adschemaAttributeObject.MapiID;
                if (dictionary.ContainsKey(mapiID))
                {
                    NspiSchemaProperties.Tracer.TraceDebug(0L, "-- Duplicate property, skipped");
                    dictionary[mapiID] = null;
                }
                else
                {
                    dictionary[mapiID] = adschemaAttributeObject;
                }
            }
            List <NspiPropertyDefinition> list        = new List <NspiPropertyDefinition>(dictionary.Count);
            Dictionary <string, PropTag>  dictionary2 = new Dictionary <string, PropTag>(dictionary.Count, StringComparer.OrdinalIgnoreCase);

            foreach (ADSchemaAttributeObject adschemaAttributeObject2 in dictionary.Values)
            {
                if (adschemaAttributeObject2 != null)
                {
                    NspiPropertyDefinition nspiPropertyDefinition = NspiSchemaProperties.CreatePropertyDefinition(adschemaAttributeObject2);
                    if (nspiPropertyDefinition != null)
                    {
                        list.Add(nspiPropertyDefinition);
                        dictionary2.Add(nspiPropertyDefinition.LdapDisplayName, nspiPropertyDefinition.PropTag);
                    }
                }
            }
            NspiSchemaProperties.all = list.ToArray();
            NspiSchemaProperties.ldapNameToPropTagMap = dictionary2;
            NspiSchemaProperties.isInitialized        = true;
        }
Exemple #3
0
        private static PropTag Lookup(ADPropertyDefinition adProperty)
        {
            NspiPropertyDefinition nspiPropertyDefinition = adProperty as NspiPropertyDefinition;

            if (nspiPropertyDefinition != null)
            {
                return(nspiPropertyDefinition.PropTag);
            }
            if (adProperty.Equals(ADRecipientSchema.DisplayName))
            {
                return(PropTag.DisplayName);
            }
            return(NspiSchemaProperties.Lookup(adProperty));
        }