无法通过共享点2013 OnPrem通过CSOM/REST API获取网站的自定义Web模板ID [英] Unable to get Custom Web Template ID of a Site by CSOM / REST API by Share point 2013 OnPrem

查看:66
本文介绍了无法通过共享点2013 OnPrem通过CSOM/REST API获取网站的自定义Web模板ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要满足项目要求的技术帮助,我需要通过CSOM/REST获取特定SharePoint 2013网站及其子网站的自定义Web模板ID和名称.我检查了许多博客,但CSOM没有公开实际的自定义网站 模板ID或名称.我的自定义模板ID,例如:{GUID} #GWXyzTestSite

我尝试使用CSOM:

但是CSOM不会公开相同的任何属性或方法.

以下是我的CSOM代码:

使用(var clientContext = CreateClientContext("URL"))
    {

                Web Web = clientContext.Web;

                clientContext.Load(web,c => c.WebTemplate);             

                clientContext.ExecuteQuery();

               字符串templateVal = web.WebTemplate.ToString(); //"BLANKINTERNET"

   }

我尝试过使用REST:

SITEURL/_api/web/GetAvailableWebTemplates(1033),但它提供了网站集中存在的所有Web模板. (想从您那里了解是否有任何解决方法可以单独获取自定义Web模板ID或该特定网站的名称)

< sitecollection>/< site>/_ api/web/webTemplate,但它以"BLANKINTERNET"的形式给出输出,而不是实际的自定义Web模板ID [例如:{GUID} #GWXyzTestSite].
 

请提供您的建议,我可以使用CSOM/REST获得任何实际的自定义Web模板ID和名称.首选CSOM.



谢谢你.


I need the technical help for my project requirement where I need to get the Custom web template ID and Name of the particular SharePoint 2013 Site and its subsites through CSOM / REST. I have checked many blogs but CSOM not exposing actual Custom Web Template ID or Name. My custom Template ID Like : {GUID}#GWXyzTestSite

 I Tried using CSOM:

But CSOM not exposing any properties or method for the same.

Below is my CSOM code :

using (var clientContext = CreateClientContext("URL"))
   {

                Web web = clientContext.Web;

                clientContext.Load(web, c=> c.WebTemplate);             

                clientContext.ExecuteQuery();

               string templateVal = web.WebTemplate.ToString(); // "BLANKINTERNET"

   }

I tried Using REST:

SITEURL/_api/web/GetAvailableWebTemplates(1033) but it gives all web templates present in Site Collection. (want to know from you is there any workaround to get Custom Web template id or name of that particular site alone)

<sitecollection>/<site>/_api/web/webTemplate but it is giving Output as "BLANKINTERNET" not actual custom web template ID[ Like : {GUID}#GWXyzTestSite ].

 

Kindly provide your suggestion that is there any workaround that I can get actual custom Web Template ID and Name using CSOM/REST. Preferable CSOM.



Thank You.


推荐答案

您可以通过REST网址中的过滤器参数来过滤Web模板,例如:

/_ api/web/GetAvailableWebTemplates(1033)?

/_api/web/GetAvailableWebTemplates(1033)?


filter = substringof('MyTeam',Title)eq true
filter=substringof('MyTeam', Title) eq true

/_ api/web/GetAvailableWebTemplates(1033)?

/_api/web/GetAvailableWebTemplates(1033)?


filter = startswith(Name,'{')
filter=startswith(Name,'{')

最好的问候,

Lee


这篇关于无法通过共享点2013 OnPrem通过CSOM/REST API获取网站的自定义Web模板ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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