无法在创建组时在自动创建的站点下创建子网站 [英] Unable to create subsite under automatically created site on group creation

查看:60
本文介绍了无法在创建组时在自动创建的站点下创建子网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用API​​创建网站,并且我可以使用API​​在其下创建子网站。 
I am able to create site using API and I am able to create subsite under it using API. 

推荐答案

以下代码供您参考。

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
function createSubSite(){
	var restAPIURL = _spPageContextInfo.siteAbsoluteUrl+"/_api/web/webinfos/add";  
	var newSiteData = JSON.stringify({
		'parameters': {  
			'__metadata': {   
				'type': 'SP.WebInfoCreationInformation'   
			},  
			'Url': 'child',   
			'Description': 'child',  
			'Title': 'child',  
			'Language': 1033,  
			'WebTemplate': 'STS',  
			'UseUniquePermissions': false  
		}  
	});


.ajax({
url:restAPIURL ,
类型:" POST",
data:newSiteData,
header:{
" accept":" application / json; odata = verbose",
"content-type":" application / json; odata = verbose",
" X-RequestDigest":
.ajax({ url: restAPIURL, type: "POST", data: newSiteData, headers: { "accept": "application/json;odata=verbose", "content-type": "application/json;odata=verbose", "X-RequestDigest":


('#__ REQUESTDIGEST')。val( )
},
成功:函数(数据){
console.log('site created');
},
错误:函数(数据){
console.log('错误crea ting site');
}
});
}

< / script>
< input type =" button"值= QUOT; CreateSubSite" onclick =" createSubSite()" />
('#__REQUESTDIGEST').val() }, success: function(data){ console.log('site created'); }, error: function(data){ console.log('Error creating site'); } }); } </script> <input type="button" value="CreateSubSite" onclick="createSubSite()"/>

如果您使用的是C#代码,请参考以下文章。

If you are use the C# code, the following article for your reference.

https ://mohitvash.wordpress.com/2015/07/01/create-sub-site-in-sharepoint-using-rest-and-c-in-console-application/

最诚挚的问候,

Dennis


这篇关于无法在创建组时在自动创建的站点下创建子网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆