Logo

Logo

深入浅出SharePoint——设置站点的默认欢迎页面

Pastore Antonio
Pastore Antonio 2022年05月26日
1416 阅读 0 评论 约 1261 字 阅读约 3 分钟

手工方式

前提分别在site collection和Site Feature中启用Feature:Office SharePoint Server Publishing。比如两个feature都启用。

由于此Feature创建了Pages library。

如果此Feature没有启用,你在设置欢迎页面的时候,将会收到如下报错信息:The site is not valid. The ‘Pages’ document library is missing.

如果相关的Feature没有启用,你将不能看到以上画面,你可以通过固定的页面地址来进行访问。比如:http://Mingle/sites/Lab/_Layouts/AreaWelcomePage.aspx

使用SharePoint对象模型:

using (SPSite site = new SPSite("http://sharepoint.com")) 
   {
    using (SPWeb web = site.RootWeb) 
       {
        SPFolder rootFolder = web.RootFolder;
        rootFolder.WelcomePage = "Pages/HomePage.aspx";
        rootFolder.Update();
      }
   }

 

使用PowerShell:

$SiteUrl = "http://sharepoint.com"
$Site = Get-SPWeb -identity $SiteUrl
$RootFolder = $Site.RootFolder;
$RootFolder.WelcomePage = "SitePages/HomePage.aspx";
$RootFolder.Update();
$Site.Dispose()

 

PS C:\> $rootFolder.WelcomePage="/person.aspx"

Exception setting "WelcomePage":"The WelcomePage property must be a path that is relative to the folder, and the path cannot contain two consecutive periods (..)."At line:1char:13+ $rootFolder.<<<<WelcomePage="/person.aspx"+CategoryInfo:InvalidOperation:(:)[],RuntimeException+FullyQualifiedErrorId:PropertyAssignmentException
特别注意:无论是在Powershell中还是在C#代码中,主页地址中起始的地方不能使用/。
查看完整代码

橙子主题打折出售

其实我不卖,主要是这里是放广告的,所以就放了一个
毕竟主题都没做完,卖了也是坑.

购买它

附件下载

共 2 个文件
08163638-c551843215eb4723a71f067061e8de59
JPG 16.5 KB
08163652-63d554054c7b424cb7ef7d2cbea95d68
JPG 40.1 KB
部分文章可能存在转载,如果涉及到侵权,请联系删除文章。

探索AIGC相关的精彩内容,共 14 篇文章

MCP | 一文详解什么是 MCP以及 MCP 可以做什么

一、什么是 MCP MCP(Model Context Protocol)是一个专为大型语言模型(L ... 深入浅出SharePoint——设置站点的默认欢迎页面

2026-02-14 · Shen, Luke
你的工作流程,值得一个“全自动数字分身”:录制、截图、成文,一气呵成

一、一句话认识 TestFlow Recorder 在数字化工作环境中,如何准确记录操作步骤并生成清 ... 深入浅出SharePoint——设置站点的默认欢迎页面

2026-02-14 · Xzavier Aaron
Flowise 前端框架配置指南

用户需求 问题:有没有适合配置 Flowise 的前端框架? 目标:寻找类似 Open WebUI ... 深入浅出SharePoint——设置站点的默认欢迎页面

2026-02-14 · Xzavier Aaron
高效AI故障诊断实践:提升企业运维能力

规划阶段 在现代企业的故障诊断过程中,规划阶段是确保诊断工作顺利开展的关键环节。通过系统化的规划,不 ... 深入浅出SharePoint——设置站点的默认欢迎页面

2026-02-14 · Shen, Luke