Tag Info

Hot answers tagged

7

Since respond.js is a presentational script, its placement within your HTML can dramatically impact page performance and execution time, especially on less capable browsers with slower JS engines. This module takes the guesswork out of placement and puts the script where it will be most effective. Optimal location is in the head after your CSS but before ...


7

Hardcoding is never a nice solution! Look in to the SuiteBarBrandingDelegate control: Elements.xml: <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- SuiteBarBrandingDelegate (the top-left "SharePoint" text on a page) --> <Control ...


6

You can copy any of the existing MasterPage's html file (I hope you have already figured that out) and go to Site Settings -> Design Manager -> Edit Master Page Now click your copied MasterPage and at the top-right you can see Snippets.. This is newly introduced in SharePoint 2013 and further explained here Now if you click Search Box, this will give you ...


6

Use the MasterUrl and CustomMasterUrl properties of Web: using (var ctx = new ClientContext( url )) { var web = ctx.Web; var masterPageUrl = String.Format( "{0}/_catalogs/masterpage/oslo.master", ctx.Web.ServerRelativeUrl ); web.MasterUrl = masterPageUrl; web.CustomMasterUrl = masterPageUrl; web.Update(); ctx.Load( web ); ...


6

On the site collection level, the SharePoint Publishing Infrastructure Feature needs to be active, and on the web level, SharePoint Server Publishing needs to be active. If not, you are not allowed to change master page.


5

MasterPage is allowed deployed at site collection scope. If you want to set your masterpage as default masterpage below are the common methods: Write code in a feature receiver. Through Powershell commands Through UI (SharePoint Publishing Infrastructure and SharePoint Publishing feature needs to be activated to do this.) Through SharePoint designer. Now ...


5

Add the ms-dialogHidden class to your outer div, it will hide the content in dialogs: <div class="ms-dialogHidden" style="background-image:url('/Style%20Library/lfr/header.jpg');background-position:left; background-repeat:repeat-x;height:147px;"></div> For more, see here: ...


5

For On-Prem installations: You can always change the master page from PowerShell using the below script: Connect-SPOService -Url "tenant admin url" -credential "username" $web = Get-SPOSite http://sharepoint $web.CustomMasterUrl = "/_catalogs/masterpage/nightandday.master" $web.MasterUrl = "/_catalogs/masterpage/nightandday.master" $web.Update() Source: ...


5

How about something like this: <script type="text/javascript"> _spBodyOnLoadFunctions.push(function(){ ExecuteOrDelayUntilScriptLoaded(showStatusAlert, "sp.js"); }) function showStatusAlert(){ var ctx = SP.ClientContext.get_current(); var web = ctx.get_web(); var list = web.get_lists().getById(_spPageContextInfo.pageListId); var ...


4

Inside the current site's Site Settings, navigate to Site Collection Administration > Site Collection Features. Activate SharePoint Server Publishing Infastructure if it's available... if it's not, you may be using SharePoint Foundation. Navigate to Site Actions > Manage Site Features, and activate the same feature (which should now be visible. Return to ...


4

Append /_layouts/changesitemasterpage.aspx to your site URL. You will get the option you are looking for.


4

Sharepoint needs some controls that are defined inside the master page or it will NOT render your master page. I suggest to refer to the following project: http://startermasterpages.codeplex.com/ to have a template where you can start to work


4

These links are loaded dynamically using the delegate controls so you wont' find these link in master page. To hide these links, add the following to your css file referenced from your master page (suggested) or add it to your master page. <style type="text/css"> #Suite_MainLink_ShellMail, #Suite_MainLink_ShellCalendar, #Suite_MainLink_ShellPeople, ...


4

You have to change the file path like if you want to refer from 15 hive, <SharePoint:CssRegistration name="/_layouts/15/mycompany/develop/styles/style.css" runat="server" after="SharepointCssFile"/> It would not cause any issues if you refer it from 14 hive. But it would be better if you move it to 15 hive as all other stuffs related to Sharepoint ...


4

After trying out different options available online, I was able to achieve it by JavaScript <!--SPM:<SharePoint:ScriptLink ID="ConfigurationScriptLink" Name="~sitecollection/SiteAssets/js/FileName.js" runat="server"/>--> CSS <!--SPM:<SharePoint:CssRegistration ID="CSSCustom" Name="&lt;% ...


3

It is NOT a good practice! ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the pages (or a group of pages) in your application. You can then create individual content pages that contain the content you want to ...


3

You can deactivate "Follow documents" feature in your site to remove Share and Follow links. For SuiteLinks you can comment the following delegate control <SharePoint:DelegateControl id="ID_SuiteLinksDelegate" ControlId="SuiteLinksDelegate" runat="server" /> For others you may need to add css/js, following link should help: SharePoint 2013 Top ...


3

take a look at this article in MSDN. It'll outline to you the procedures and limitations about localizing Sandboxed solutoins (same applies to SP 2013): Localization of Sandboxed Solutions in SharePoint 2010


3

Your custom master page should NOT be residing in LAYOUTS directories, but instead to inside of a custom feature destined to "GhostableInLibrary". The reason being the performance and the fact that file itself will not be stored in the content database, and hence SharePoint will continue to use a cached copy of the file from the file system until it has been ...


3

You can assign a master page in the layouts folder programmatically to a site (SPWeb). In PowerShell it would look something like: $site = Get-SPSite "http://yoursitecollection" foreach ($web in $site.AllWebs) { $web.MasterUrl = "/_layouts/15/yourfolder/themaster.master" $web.CustomMasterUrl = "/_layouts/15/yourfolder/themaster.master" ...


3

b. You can remove this in Master page: <SharePoint:DelegateControl id="ID_SuiteBarBrandingDelegate" ControlId="SuiteBarBrandingDelegate" runat="server"/> Instead paste needed text. Use Microsoft Sharepoint Designer to do this.


3

If you have to show/hide parts of the Ribbon based on permissions then SPSecurityTrimmedControl is the ideal way to do it even if you are on SP 2013. You can use ViewListItems permissions to hide the Ribbon from users with Read Only permissions. See this http://msdn.microsoft.com/EN-US/library/ms412690 for all possible types of Permissions which can be used. ...


3

Create an Event Receiver. In Visual Studio, right click project => Add new item => Event Receiver => Web Events, Handle the following events: A Site is being provisioned. The following override will be generated and fire on every new site creation. Just insert the code within: public override void WebProvisioned(SPWebEventProperties properties) { ...


3

As I suggested in a comment to another answer, there are numerous ways to accomplish this that don't involve deploying server-side code into SharePoint. Here are a few that I could think of, I may have left some out; each have some advantages and possible challenges. TL;DR: Use the JavaScript injection pattern (especially with SharePoint Online - -- this ...


3

Perhaps your issue has something to with something SharePoint Designer is doing. Try resetting the master page to the site definition, then download a copy of your master page from the master page gallery using the web UI. Rename the file and make a minor modification and upload it back via the web UI with the new name. Then select the new master page in ...


2

In Init.Js there is a function called AllowCSSFiltersOnIE8(). It checks for IE version and if it is Ie8 or below. Adds "ms-core-needIEFilter" css class to body tag, then checks for border style on ms-hcTest, and if it is not applied, removes css filter for s4-workspace. So this element is just for checking whether there is a need to use filters or not. And ...


2

Found the issue. Because the property in my web template "ContainsDefaultLists" was set on TRUE and it should be FALSE


2

If it is a Publishing web site then you can use SetInherit so that subsites will inherit the custom master page. Example: SPWeb web = SPContext.Current.Web; PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web); publishingWeb.CustomMasterUrl = "/_catalogs/masterpage/mycustom.master"; publishingWeb.CustomMasterUrl.SetInherit(true, true); ...


2

I do believe Site Collection scope is correct for a masterpage feature. The problem is, you cannot force subsites to use this masterpage (even though there's an option to reset all subsites in the UI). EDIT: If it's a publishing web you can do this, look at @Nadeem Yousuf's answer You will have to iterate over all the current SPWeb subsites and set their ...


2

Remember that Application pages are just normal .aspx pages, nothing SharePoint specific. So you can just remove the DynamicMasterPageFile property from the <%@ Page %> tag. Just remember to add html, head, body now that a masterpage is no longer dictating the html structure.



Only top voted, non community-wiki answers of a minimum length are eligible