简体   繁体   中英

How to apply host web custom master page to sharepoint hosted app in sharepoint online

I have created a SharePoint hosted app and deployed it to my Online site. But is there a method to apply host web custom master page to SharePoint hosted app.

Please solve this issue.

To apply the same master page of host web on your App web please follow the below steps if you are on Publishing site or you have already activated the publishing feature on your site. 1.Go to site setting-> then click on Master page-> on the Root Web you can check the box "Reset all subsites to inherit this site master page setting" 2. Now if you open your app web you will found an error over there. For that either you can uninstall your app and redeploy the same or you can use powershell script to fix the issue

param([String]$PortalUrl)

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"

if(!$PortalUrl)
{
    $SelectedPortalUrl = Read-Host -Prompt "Please enter the URL of the     portal you want to fix:"
}
else
{
  $SelectedPortalUrl = $PortalUrl
}

Get-SPSite $SelectedPortalUrl | Get-SPWeb -Limit All -filter { $_.Template -  eq "APP" } | Foreach-Object {

$_.MasterUrl = $_.ServerRelativeUrl + "/_catalogs/masterpage/app.master"
$_.CustomMasterUrl = $_.ServerRelativeUrl + "/_catalogs/masterpage/app.master"
$_.Update()

Write-Host "Fixed: " $_.Name -Fore Green
}

Please refer the link this link for more details http://www.casvaniersel.com/2015/01/custom-masterpages-and-sharepoint-hosted-apps/ You can do more modification via using "Chrome Control" Please refer the link below https://msdn.microsoft.com/en-us/library/office/fp179916(v=office.15).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM