网站栏未在内容类型下显示-SharePoint 2013 c# [英] site Column Not showing under content type - SharePoint 2013 c#

查看:66
本文介绍了网站栏未在内容类型下显示-SharePoint 2013 c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用xml文件创建了一个网站栏,它们显示在网站内设置->中.网站栏.我已将此列添加到内容类型元素文件并发布了wsps.当我转到网站设置->网站内容类型,然后选择 我也已添加该列的内容类型,该列未显示.我已经通过Powershell发布,也通过Visual Studio发布,我也撤消了该功能并再次部署了该功能,但该列仍未在内容类型下显示.做 有人知道该怎么办?

I created a site column using an xml file and they are showing in the in site settings -> site columns. I have added this column to the content type element file and published the wsps. When i go to site settings -> site content type and select the content type that i have added the column too, The column is not showing. I have published through powershell and also trough Visual Studio, I also retracted the feature and deployed it again but the column is still not showing under the content type. Does some know what can be done?

谢谢

推荐答案

请检查下面的代码以将网站栏添加到内容类型.

Please check the code below to add site column to a content type.

using (SPSite site = new SPSite("http://sp2013/"))
{
	using (SPWeb web = site.RootWeb)
	{
		SPContentType ct = web.ContentTypes["_Custom Content Type"];
		SPField field = web.Fields["Custom Site Column"];
		SPFieldLink fieldLink = new SPFieldLink(field);
		ct.FieldLinks.Add(fieldLink);
		ct.Update();
	}
}

或者您可以提供代码以供进一步研究.

Or you can provide the code for further research.

最好的问候,

丹尼斯


这篇关于网站栏未在内容类型下显示-SharePoint 2013 c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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