3

I saved an old wiki library as a template w/ content and then created a wiki library from that template. The new wiki, however, shows all the wiki pages in a list of files because the new wiki home page URL is "/Forms/AllPages.aspx" instead of the normal default "home.aspx".

The "home.aspx" page is in the list of the wiki pages and I want to make it the default home page for my wiki like it would be if I made a wiki from scratch. Is this possible to change?

I've tried opening the site in SP Designer, selecting "home.aspx", and setting it as the home page. This set's my top-level site's homepage, though, which is not what I want.

Additional Details: Using SP Online for new location, the old library was on-premise SP2010.

4
  • Shot in the dark here as I don't have SP Online: Open the page in a web browser, click on the Page tab, then click Make Homepage in the Page Actions section.
    – Underverse
    Commented Mar 7, 2016 at 23:16
  • This only changes the home page of the site the wiki library lives in.
    – Braden
    Commented Mar 7, 2016 at 23:30
  • 2
    Create a redirect page as your homepage and redirect it to your wiki page. Pretty sure you can't set a page from a different site as the homepage of another site
    – Roland
    Commented Mar 8, 2016 at 2:01
  • Can you elaborate on this Roland? I'm not trying to set a page from a different site as the home page of another site. I copied an existing wiki as a template and then created a new one using that template. However, instead of the wiki using the "home.aspx" page as it's default page, it's using "/forms/allpages.aspx. If you create a new wiki, it's default is "home.aspx", so really all I'm trying to do is set it up like a default wiki would be.
    – Braden
    Commented Mar 8, 2016 at 16:21

1 Answer 1

1

You should be able to achieve this using CSOM. The sample code below works on a Wiki Page Library created in Office 365:

# Enter your credentials and the site URL here
$username = "[email protected]"  
$password = "Pass@word"  
$url = "https://mydomain.sharepoint.com/sites/MyTeamSite"
$securePassword = ConvertTo-SecureString $Password -AsPlainText -Force  

# The path here may need to change
# Copy the SP2013 DLLs into a suitable location such as c:\Lib
Add-Type -Path "C:\Lib\Microsoft.SharePoint.Client.dll"  
Add-Type -Path "C:\Lib\Microsoft.SharePoint.Client.Runtime.dll"  

# connect/authenticate to SharePoint Online and get ClientContext object... 
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url)  
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword)  
$clientContext.Credentials = $credentials  

if (!$clientContext.ServerObjectIsNull.Value)  
{  
    Write-Host "Connected to SharePoint Online site: $Url"  
}  

# Grab the root web context
$rootWeb = $clientContext.Web 
$clientContext.Load($rootWeb) 
$clientContext.ExecuteQuery() 

# Grab the lists
$lists = $rootWeb.Lists
$clientContext.Load($lists) 
$clientContext.ExecuteQuery()

# Find the correct list. Enter the title of your list.
$list = $clientContext.Web.Lists | where {$_.Title -eq "Wiki"}
$clientContext.Load($list) 
$clientContext.ExecuteQuery()

# Set the root folder welcome page to the correct value and update
$list.RootFolder.WelcomePage="Home.aspx"
$list.RootFolder.Update()
$clientContext.ExecuteQuery()

I hope that helps!

3
  • Andy, I keep getting an error after trying to run "$clientContext.ExecuteQuery()" after loading $rootWeb. It states "exception calling "executequery" with "0" arguments: The remote server returned an error: (403) Forbidden.". Any ideas?
    – Braden
    Commented Mar 8, 2016 at 22:09
  • It appears my credentials were failing. Nevermind Andy!
    – Braden
    Commented Mar 8, 2016 at 22:20
  • Glad you got it sorted! Commented Mar 9, 2016 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.