如何用vs获取到在建站里站点模版的

101sayyes 2013-01-27 03:52:59
在我们建一个网站时,都会有些如:team site,blank site等等这样的模版可选,现在我有个任务,要建一个WEBPART,里面显示一个这些模版的列表,输入标题和URL后,点击按钮新建一个站点,请问如何用程序获得这些模版网站的列表,建站时分别怎么带参数建立所选模版的站点
...全文
88 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
天涯海角 2013-01-28
  • 打赏
  • 举报
回复

//Check if sub site exists at given site collection
private static bool isWebExists(SPSite spSite, string webRelativeUrl)
{
    bool returnVal = false;
    using (SPWeb currentWeb = spSite.OpenWeb(webRelativeUrl, true))
    {
        returnVal = currentWeb.Exists;
    }
    return returnVal;
}
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.exists(v=office.12).aspx
101sayyes 2013-01-28
  • 打赏
  • 举报
回复
谢谢,正在试,追问一个问题,用什么方法知道指定的网站名和URL是否已经存在了
段传涛 2013-01-27
  • 打赏
  • 举报
回复
参考一下吧。不知道有没有用。 http://blog.csdn.net/jason_dct/article/details/8546874
天涯海角 2013-01-27
  • 打赏
  • 举报
回复

using (SPSite site = new SPSite ("http://mosshost/" ))
{
 SPWebTemplateCollection temlates1 = site.GetCustomWebTemplates(1033);

 SPWebTemplateCollection temlates = site.GetWebTemplates(1033);
  .........
}
1033是英文的语言代码,中文好像是2052

3,245

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 SharePoint
社区管理员
  • SharePoint社区
  • 霖雨 - LinyuLoveTJ
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧