sharepoint ECMA using a custom contentType to creating a list in SubSite

Using a custom contentType to creating a list:



function GetContentType()
{
var clientContext = new SP.ClientContext(siteUrl);
var currentWeb = clientContext.get_web();
var contentTypeCollection = currentWeb.get_contentTypes();
var contentType = contentTypeCollection.getById("0x01010038CBF7FA14024D2688184E50E84E3239");
clientContext.load(contentType);
clientContext.executeQueryAsync(
Function.createDelegate(this, onQuerySucceeded),
Function.createDelegate(this, onQueryFailed)
);
}

function onQuerySucceeded(){

var count = subWebs.get_count();
if (count > 0) {
for (var i = 0; i < count; i++) {
var subWeb = subWebs.itemAt(i);
var list = subWeb.get_lists().getByTitle("12");
//get this list all contentType
var sublistContentTypeCollection = list.get_contentTypes();
//if this contentType is no add this contentType;
sublistContentTypeCollection.addExistingContentType(contentType);
clientContext.load(subWeb);
clientContext.load(list);
clientContext.load(sublistContentTypeCollection);
clientContext.executeQueryAsync(Function.createDelegate(this, onQuerySucceededContentType), Function.createDelegate(this, onQueryFailedContentType));
}
}
}

?





1

此处需要注意的是,必须通过主站点查找到下面的子站点,只有这样才能通过custom contentType 创建成功list





sharepoint ECMA using a custom contentType to creating a list in
SubSite,布布扣,bubuko.com

sharepoint ECMA using a custom contentType to creating a list in
SubSite

时间: 2024-10-19 16:23:19

sharepoint ECMA using a custom contentType to creating a list in SubSite的相关文章

sharepoint ECMA using a list template to creating a list in SubSIte

Using a list template to creating a list in SubSIte ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 function CreateList(){         var clientContext = new SP.ClientContext(siteUrl);         v

sharepoint ECMA 添加指定的人员和指定的角色到某个list里

有的时候我们需要给某个list添加指定的人员和指定的角色:具体代码如下: 1 function AddUserAndRoleToList() { 2 var SubClientContent =new SP.ClientContext(siteUrl); 3 var SubWeb = SubClientContent.get_web(); 4 var subList = SubWeb.get_lists().getByTitle(self.DocumentName()); 5 $("div[id

sharepoint ECMA PeopleEditor 清除选中的中的人员

当我们在用sharepoint中自带的人员选择器PeopleEditor的时候,有的时候会用js来清除选择的人员,这个时候就需要用到下面的的几段代码: var currentPeopleEditorID="ctl00_PlaceHolderMain_peUsers"; $("#" + getSubControlID("currentPeopleEditorID", g_EntityEditorUpLevelId) + "").

sharepoint ECMA 添加User到Site组

1 self.GetGroup = function (subSiteurl) { 2 var subClientContent = new SP.ClientContext(subSiteurl); //获取当前站点 3 var groupCollection = subClientContent.get_web().get_siteGroups();//获取当前站点中所有的Group 4 var ownersGroup = groupCollection.getByName("SpeadTr

sharepoint ECMA

在使用SharePoint ECMAScript之前,我们需要引入几个JS文件: SP.js SP.Core.js SP.Runtime.js SP.js:包含主要的能够用来获取sharepoint数据的对象,如ClientContext.Web.List.Listitem等 SP.Core.js:包含一些实用对象和帮助对象,能够用来完成基本的任务,如HTML编码.URL处理.XML字符串操作等 SP.Runtime.js:包含了核心的ECMAScript运行时的对象,封装了客户端对象模型和服务

Custom Data Service Providers

Custom Data Service Providers Introduction Data Services sits above a Data Service Provider, which is responsible for interacting with the underlying Data Source on behalf of the Data Service. Data Services ships with some internal providers, and mak

SharePoint 2013 自定义扩展菜单

原文:SharePoint 2013 自定义扩展菜单 在对SharePoint进行开发或者功能扩展的时候,经常需要对一些默认的菜单进行扩展,以使我们开发的东西更适合SharePoint本身的样式.SharePoint的各种功能菜单,像网站设置.Ribbon.列表里的下拉等等,都是一样原理的,都是XML+JS脚本实现的,如果想实现这些功能,只需要一个XML发布成Feature,并在网站功能启用,即可. 其实,关于这个并没有什么过多可以说的东西,大家在实践中,渐渐理解了.下面,我就举几个简单的例子,

SharePoint Online 、office 365缺少将站点另存为模板选项

之前文章行给出在SharePoint 2010 .SharePoint 2013 中将站点保存模板选项的文章.其实同样的问题出现在Microsoft Office 365的一部分SharePoint Online中,所以在这篇文章做一下分享. 我们注意到SharePoint中缺少"将网站另存为模板"选项的最常见原因与启用SharePoint发布功能有关.当您启用SharePoint Server发布功能时,它将禁用将网站另存为模板的功能.微软在相关KB给出解决方法 如 通过ShareP

Professional C# 6 and .NET Core 1.0 - 40 ASP.NET Core

本文内容为转载,重新排版以供学习研究.如有侵权,请联系作者删除. 转载请注明本文出处:Professional C# 6 and .NET Core 1.0 - 40 ASP.NET Core ----------------------------------------------------------------------- What's In This Chapter? Understanding ASP.NET Core 1.0 and Web Technologies Using