zoukankan      html  css  js  c++  java
  • Set the Welcome Page in SharePoint through Code

    默认情况下,SharePoint使用sitepagesHome.aspx作为welcome page,但有时我们需要使用定制页面作为welcome page。在SharePoint中, 设置Welcome Page的方式跟Web是否Publish有关,即SharePoint Server Publishing Infrastructure是否启动。

    1. SharePoint Server Publishing Infrastructure这个feature没启动时的设置方式:

    SPFolder rootFolder = web.RootFolder;
    rootFolder.WelcomePage = "SitePages/customHomePage.aspx";
    rootFolder.Update();
     
    2.如果SharePoint Server Publishing Infrastructure已经启动,则使用一下方式进行设置,否则虽然后台代码能够设置成功,但是页面还是会报错误:The DataSourceID of 'TopNavigationMenu' must be the ID of a control of type IHierarchicalDataSource
    
      if (PublishingWeb.IsPublishingWeb(web))
       {
                        PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
                        SPFile welcomeFile = web.GetFile(squarePath);
    
                        publishingWeb.DefaultPage = welcomeFile;
                        publishingWeb.Update();
                    }
                   
  • 相关阅读:
    如何选择机器学习算法 转
    机器学习经典算法详解及Python实现--基于SMO的SVM分类器
    机器学习(Machine Learning)&深度学习(Deep Learning)资料
    计算智能在设备状态维护中的应用
    LaTeX 在编译时出现 File ended while scanning use of @writefile错误
    LaTeX 中插入图片使其紧跟插入的文字之后
    LaTeX 制作表格
    LaTeX 中换段落
    LaTeX 中使用三级标题
    使用 WinEdt 来写中文文章or 建模论文
  • 原文地址:https://www.cnblogs.com/snailJuan/p/3361304.html
Copyright © 2011-2022 走看看