zoukankan      html  css  js  c++  java
  • SharePoint 2010 change home page或者default page

    SharePoint: How to change the default home page

     

    I frequently get questions on changing the home page or using another page as the home page:

    • Can I have three (or four or five or…) columns in the default home page?
    • Do I have to use the new wiki home page in my Team Site?
    • I want to test a new home page design, but I don’t want to lose the existing home page… (just in case you know…)
    • How can I use a page from my wiki library as my home page?

    Below are four ways to set another page as your home page: (all four work for both 2007 and 2010)

    • From Site Settings (If the publishing features are enabled)
    • From SharePoint Designer
    • From code / API
    • From PowerShell

    The first two can be used by Site Owners, the second two can only be used for developers and administrators.

    Important note for all four methods:

    Make sure all of your users have at least read access to the new home page, and if in a library that you have it checked in and published.

    If the publishing features are enabled for a site then:

    Site Actions, Site Settings, Welcome Page

    (that was easy!)

    2007:

    image

    2010:

    image

    From SharePoint Designer:

    Right-click the new page and click "Set as Home Page".  (For SharePoint 2007 this only appears to work from SharePoint Designer if the file is in the root of the site. I.e. the same place as default.aspx.)

    image

    Via the API:

    C# and VB developers can use the SPFolder.WelcomePage property. See:
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.welcomepage.aspx

    Via PowerShell:

    For SharePoint 2010:

    $site = Get-SPSite http://yourserver/sites/yoursite
    $web = $site.RootWeb
      (or $web = $site.OpenWeb("yoursubsite")
    $folder = $web.RootFolder
    $folder.WelcomePage = "SitePages/home.aspx"
      (or  $folder.WelcomePage = "default.aspx")
      (or  $folder.WelcomePage = "Shared%20Documents/mycustomwebpartpage.aspx")
    $folder.update()
    $web.Dispose()
    $site.Dispose()

    For SharePoint 2007 (the first two lines are different):

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $site = New-Object Microsoft.SharePoint.SPSite("http://yourserver/sites/yoursite")
    $web = $site.RootWeb
      (or $web = $site.OpenWeb("yoursubsite")
    $folder = $web.RootFolder
    $folder.WelcomePage = "SitePages/home.aspx"
      (or  $folder.WelcomePage = "default.aspx")
      (or  $folder.WelcomePage = "Shared%20Documents/mycustomwebpartpage.aspx")
    $folder.update()
    $web.Dispose()
    $site.Dispose()
  • 相关阅读:
    第二章 PROCESSES AND THREADS
    第一章 PROBLEMS
    第10章 图 10.1
    day2_jmeter关联的两种实现方式
    jmeter做SOAPui接口的性能测试
    day1_json_viewer美化接口请求、接口用例设计的方式和接口测试的必要性
    day1_jmeter接口如何添加断言
    day1_jmeter操作mysql步骤
    day1_jmeter添加cookie管理器和header信息头管理器
    day1_postman和jmeter处理接口入参既有key-value类型,也有上传文件类型的方式,利用postman实现自动化
  • 原文地址:https://www.cnblogs.com/ahghy/p/3119269.html
Copyright © 2011-2022 走看看