Exemplo n.º 1
0
        public override object GetRealSPObject()
        {
            if (realObject != null)
            {
                return(realObject);
            }

            object parentObj = base.ParentNode.SPObject;

            if (parentObj != null)
            {
                if (parentObj is ContentTypeCollection)
                {
                    ContentTypeCollection contentTypes = parentObj as ContentTypeCollection;

                    if (contentTypes.Any(c => c.Name == this.Title))
                    {
                        realObject = contentTypes.FirstOrDefault(c => c.Name == this.Title);
                        return(realObject);
                    }
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        private ContentType GetContentType(ContentTypeCollection contentTypes, string contentTypeName)
        {
            ContentType content = null;

            if (contentTypes == null || contentTypes.Count <= 0 || string.IsNullOrEmpty(contentTypeName))
            {
                return(content);
            }

            return(contentTypes.FirstOrDefault(x => x.Name.Equals(contentTypeName)));
        }
Exemplo n.º 3
0
 private ContentType GetContentType(ContentTypeCollection collection, string contentTypeName = "")
 {
     contentTypeName = string.IsNullOrEmpty(contentTypeName) ? contentTypeName : Name;
     return(collection.FirstOrDefault(x => x.Name.Equals(contentTypeName)));
 }