TaxonomyWebTaggingControl使用JSOM设置SspId和SSPList [英] TaxonomyWebTaggingControl Set SspId and SSPList using JSOM

查看:66
本文介绍了TaxonomyWebTaggingControl使用JSOM设置SspId和SSPList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Folks,


有没有办法使用JSOM设置TaxonomyWebTaggingControl Set SspId和SSPList?


要求是动态设置 - 假设取决于其父级,分类法字段控制sspid / ssplist映射应该更改。


尝试使用以下博客但不知何故不起作用 -  


https://msdn.microsoft.com/en-us/library/office/dn312504.aspx?f=255&MSPPError=-2147217396


https ://www.c-sharpcorner.com/article/map-term-set-to-metadata-site-column-on-sharepoint-using-javascript-object-model/


https://blog.vgrem.com/tag/taxonomyfieldvalue/


https://gist.github.com/chrisobriensp/13e69f9dfb9d8221c05c


谢谢

解决方案


TaxonomyWebTagging Control是SharePoint Visual Web Part中使用的服务器端控件,对于此控件属性SspId和SSPList,需要通过Server Obje设置ct Model因为没有Client Side API为服务器端
控件设置这两个属性,你可以根据你自己的逻辑设置Page_Load中的属性,如下所示:

 protected void Page_Load(object sender,EventArgs e)
{
SPContext context = SPContext.Current;
SPSite site = context.Site;
TaxonomySession session = new TaxonomySession(site);
TermStore termStore = session.TermStores [" Mananged Metadata"];
Group group = termStore.Groups [" System"];
TermSet keywordsTermSet = group.TermSets [" Keywords"];
TestTaxonomyControl.SspId.Add(termStore.Id);
TestTaxonomyControl.TermSetId.Add(keywordsTermSet.Id);
TestTaxonomyControl.SSPList = termStore.Id.ToString();
TestTaxonomyControl.AllowFillIn = true;
TestTaxonomyControl.IsMulti = true;
}

在页面中添加了Web部件,它将显示此控件:



谢谢


最好的问候


Hello Folks,

Is there any way to set the TaxonomyWebTaggingControl Set SspId and SSPList using JSOM ?

The requirement is to get it set on the fly - suppose depending on its parent the Taxonomy Field Control sspid/ssplist mapping should change.

Tried using the below blog but somehow not working - 

https://msdn.microsoft.com/en-us/library/office/dn312504.aspx?f=255&MSPPError=-2147217396

https://www.c-sharpcorner.com/article/map-term-set-to-metadata-site-column-on-sharepoint-using-javascript-object-model/

https://blog.vgrem.com/tag/taxonomyfieldvalue/

https://gist.github.com/chrisobriensp/13e69f9dfb9d8221c05c

Thanks

解决方案

Hi,

TaxonomyWebTagging Control is a Server Side Control used in SharePoint Visual Web Part, for this control Property SspId and SSPList, it needs to be set via Server Object Model since there is no Client Side API to set this two property for the server side control, you could set the property in Page_Load void based on your own logic like below:

 protected void Page_Load(object sender, EventArgs e)
        {
            SPContext context = SPContext.Current;
            SPSite site = context.Site;
            TaxonomySession session = new TaxonomySession(site);
            TermStore termStore = session.TermStores["Mananged Metadata"];
            Group group = termStore.Groups["System"];
            TermSet keywordsTermSet = group.TermSets["Keywords"];
            TestTaxonomyControl.SspId.Add(termStore.Id);
            TestTaxonomyControl.TermSetId.Add(keywordsTermSet.Id);
            TestTaxonomyControl.SSPList = termStore.Id.ToString();
            TestTaxonomyControl.AllowFillIn = true;
            TestTaxonomyControl.IsMulti = true;
        }

And in the page, added the web part, it will show this control:

Thanks

Best Regards


这篇关于TaxonomyWebTaggingControl使用JSOM设置SspId和SSPList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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