Jun*_*ior 3 c# sharepoint csom
我想在C#中使用CSOM为我的Sharepoint站点设置欢迎页面.
基本上我正在做的是将我的新欢迎页面(home.aspx)上传到网站页面或页面,然后我想更改欢迎页面以匹配我新上传的页面位置.
我环顾四周,但我看到的很多东西都是PowerShell或服务器端代码.
如果有人能指出我正确的方向,我会非常感激.
如何通过SharePoint CSOM设置欢迎页面
public static void SetWelcomePage(Web web,string pageUrl)
{
var ctx = web.Context;
var rootFolder = web.RootFolder;
rootFolder.WelcomePage = pageUrl;
rootFolder.Update();
ctx.ExecuteQuery();
}
Run Code Online (Sandbox Code Playgroud)
用法
using (var ctx = new ClientContext(webUri))
{
SetWelcomePage(ctx.Web, "SitePages/default.aspx");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4414 次 |
| 最近记录: |