Пример #1
0
        public static string GetContentValue(Content content, SyncProperty portalProp)
        {
            var propValue = content[portalProp.Name];

            if (propValue == null)
            {
                return(null);
            }
            return(propValue.ToString());
        }
Пример #2
0
        public static string GetEntryValue(DirectoryEntry entry, SyncProperty adProp)
        {
            var propValColl = entry.Properties[adProp.Name];

            if (propValColl == null)
            {
                return(string.Empty);
            }

            string value = null;

            if (propValColl.Count >= 1)
            {
                value = propValColl[0] as string;
            }
            return(value ?? string.Empty);
        }
Пример #3
0
        public static void SetContentValue(Content content, SyncProperty portalProp, string value, ADObjectType type)
        {
            var propValue = value.MaximizeLength(portalProp.MaxLength);

            if (portalProp.Name == "Name")
            {
                content.Name = propValue;

                // in case of AD users the login name should be the same as the content name
                if (type == ADObjectType.User)
                {
                    content["LoginName"] = propValue;
                }
            }
            else
            {
                content[portalProp.Name] = propValue;
            }
        }