zoukankan      html  css  js  c++  java
  • 得到站点中所有的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"];
     
  • 相关阅读:
    multiprocessing总结
    CPython在CPU密集型应用下的并发
    多线程交互
    线程等待与守护线程
    Python多线程(1)
    一个简单的单线程异步服务器
    多线程与多进程的实现
    socket的功能分割到不同函数
    数据处理项目Postmortem
    M2 终审
  • 原文地址:https://www.cnblogs.com/blackbean/p/2607191.html
Copyright © 2011-2022 走看看