Showing posts with label MasterPage in SharePoint. Show all posts
Showing posts with label MasterPage in SharePoint. Show all posts

Tuesday, March 29, 2016

How to get current master page and change it on the Site using javascript

 GET request

/_api/Web?$select=CustomMasterUrl,MasterUrl

function MastePageChange() {
    var clientcontext;
    var cweb;
    var customMasterURL = '/_catalogs/masterpage/NewMasterPage.master';
    clientcontext = new SP.ClientContext.get_current();
    cweb = clientcontext.get_web();
    cweb.set_customMasterUrl(masterPageUrl);
    cweb.set_masterUrl(masterPageUrl);
    cweb.update();
    clientcontext.executeQueryAsync(function() {
        alert("Master Page has been changed successfully \n" + customMasterURL);
    }, function(sender, args) {
        alert("Error: " + args.get_message());
    });
}

MastePageChange();

Friday, January 29, 2016

How to Hide Ribbon from Anonymous users in SharePoint 2013

In 2013, we can’t modify the master page .master. We need to modify the .html file associated with the master page.

We have to modify .html
 <!--MS:--> and <!--ME:--> that shows the markup inside of the tags for the  masterpage


Search for text in html file “<div class =”ms-belltown-anonshow”>” tag

<!—MS:<SharePoint:SpSecurityTrimmedControl runat=”server” permission=”AddandCustomizepages”>—>

Add following code after closing div tag.

<!—MS:</SharePoint:SpSecurityTrimmedControl>—>




Sunday, January 10, 2016

how to hide master page style in list ,libraries and pages or popups ,IsDlg=0, IsDlg=1?


When user add URL  IsDlg=0, IsDlg=1
Add &IsDlg=1

hidden Ribbon bar 
Add &IsDlg=0

but there’s no scroll bars


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script type="text/javascript">

_spBodyOnLoadFunctionNames.push("hideItAll");

function hideItAll(){
    if(window.location.search.toLowerCase().indexOf("isdlg=1") > 0){
        $("#s4-ribbonrow").hide(); //ribbon bar

        //because the bar joins us late in the game, we need to throw CSS in to hide it
        $("head").append("<style>#Hero-WPQ2 { display:none }</style>");

        $("#CSRListViewControlDivWPQ2").hide(); //views and search bar
    }
}
</script>

Wednesday, December 9, 2015

To fix Add an App option in SharePoint 2013 "Apps you can add" is missing

Add the below lines in the MasterPage in SharePoint

<!--SPM:<SharePoint:AjaxDelta id="DeltaPlaceHolderLeftNavBar" BlockElement="true" runat="server">-->
<!--SPM:<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">-->
<!--SPM:</asp:ContentPlaceHolder>-->
<!--SPM:</SharePoint:AjaxDelta>-->
<!--SPM:<SharePoint:AjaxDelta id="DeltaPlaceHolderPageTitleInTitleArea" runat="server">-->
<!--SPM:<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server">-->
<!--SPM:</asp:ContentPlaceHolder>-->
<!--SPM:</SharePoint:AjaxDelta>-->

Friday, October 30, 2015

When click subsite logo to redirect to root site in Sharepoint site

In this post, site logo change to root site

1.Open you master page

For this generte site logo in Snippet Gallery

2.Find the text SharePoint:SPSimpleSiteLink
<!--MS:<SharePoint:SPSimpleSiteLink runat="server" CssClass="ms-siteicon-a" ID="x7917ecc8c38eab54c8c8d4bd69f58e33">-->
... 
<!--ME:</SharePoint:SPSimpleSiteLink>-->

3.Replace the text


<!--MS:<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f5afkaf932523">-->
...

<!--ME:</SharePoint:SPLinkButton>-->


4.For site collection redirect option, Add the attribute NavigateUrl to this tag and set it value to "~sitecollection"
4.For site current site redirect option, Add the attribute NavigateUrl to this tag and set it value to "~site"

NavigateUrl="~sitecollection/"
NavigateUrl="~site/"


Tuesday, August 11, 2015

Default master pages in SharePoint 2013

Custom.master
System pages, such as forms and views. Used by all SharePoint 2013 and SharePoint Online SKUs.
Default.master
Site pages in publishing sites. Included in all SharePoint 2013 and SharePoint Online SKUs. Available when the publishing feature is activated.
Application.master
Some system pages, such as scope.aspx and keyword.aspx. Included in all SharePoint 2013 and SharePoint Online SKUs. Minimal.master
Available default master page option in all SharePoint 2013 SKUs.
Seattle.master
Available default master page option in all SharePoint 2013 and SharePoint Online SKUs.
Oslo.master
Available default master page option in all SharePoint 2013 and SharePoint Online SKUs.
Kyoto.master
A master page available in SharePoint Online.
Berlin.master
A master page available in SharePoint Online.
Lyon.master
A master page available in SharePoint Online.
Mysite15.master
OneDrive for Business sites (previously: My Site, personal sites, or OneDrive Pro sites).

Wednesday, May 27, 2015

How to resolver SharePoint 2013 Literal content (' ') is not allowed within a 'System.Web.UI.UpdatePanelTriggerCollection'

The Literal content (' ') is actually an html non-breaking space that gets added when editing the page in SharePoint Designer for the first time


        

      

Remove the $nbsp; and save the page again to clear the error.