• 得到站点中所有的Content Type





    SPContentTypeId
    id =newSPContentTypeId(BaseContentTypeId);
    IList<SPContentType>ContentTypes= web.ContentTypes.Cast<SPContentType>().Where(c => c.Id.IsChildOf(id)).ToList();



    using(SPSite site =newSPSite(SPContext.Current.Site.Url))
    {
     
    using(SPWeb web = site.OpenWeb())
       
    {
         
    SPContentTypeCollection allContentTypes = web.ContentTypes;
                   
    SPContentTypeCollection docContentTypes =null;
                   
    foreach(SPContentType objContentType in allContentTypes)
                   
    {
                       
    if(objContentType.Parent.Name=="Document")
                       
    {
                            docContentTypes
    .Add(objContentType);
                       
    }
                   
    }
                   
    // docContentTypes contains all content types derived from content type "Document". You can implement additional checks and add this into a drop down list.
       
    }
    }
    可以通过名字去取:
    SPContentType spct = web.AvailableContentTypes["ContentTypeName"];
     
  • 相关阅读:
    Flutter-路由
    写一个底部Tabs导航动态组件
    实例:Flutter布局01
    HTTP报文
    HTML文本的各种属性
    HTML必要简介和基础
    MySQL8.0.23安装超详细傻瓜式
    从一个HTTP请求来研究网络分层原理
    MySQL的增删改查
    MySQL常用数据类型有哪些?
  • 原文地址:https://www.cnblogs.com/blackbean/p/2607191.html
Copyright © 2020-2023  润新知