Tag Info

Hot answers tagged

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

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

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

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

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

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 ...


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

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.


2

You should have a line similar like this in your .aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateCollabWeb.aspx.cs" Inherits="Something.Layouts.CreateCollabWeb" DynamicMasterPageFile="~masterurl/default.master" %> Here you can point to a different master page: <%@ Page Language="C#" AutoEventWireup="true" ...


2

You can use jQuery for this.use the below script to add class in the user control. $(document).ready(function(){ var className='class1';//here write logic for deciding the classname . $('div[id*="new-div"]').addClass(className); });


2

SharePoint specific SharePoint provides the _spBodyOnLoadFunctionNames array. When the body is loaded, the onload event handler executes each function whose name is contained in this array, for example: _spBodyOnLoadFunctionNames('funcName'); function funcName() { //... } jQuery Specify a function to execute when the DOM is fully ...


2

It appears that this has to do with IE9, IE10, IE11 document standards for the client's browser. The problem is in the pickerdialog.master. As the People Picker is using the pickerdialog.master file, you need to add the following line in the head element. meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" Find the pickerdialog.master file in ...


2

Microsoft has recently made some change to O365. I can not verify if this was a change but there is no ID for DeltaSuitBar on the rendered page. There is a class you could use "ms-core-deltaSuiteLinks" as well as an ID of "suiteLinksBox" that will also work for applying a hidden style too. You can try this by opening the console window of your browser ...


2

If publishing is enabled, you can simply set the master page in the root site collection, and push it down to all subsites: Code will be required if publishing is not enabled, or if you need to deploy to multiple site collections. Here is an example using CSOM (only updates a single web): using (var clientContext = new ClientContext(url)) { var web ...


2

The solution should completely depend on what SharePoint farm you are using, Online or on-premise. Also, if you are using on-premise, is there a possibility that you will be shifting to the cloud soon? Apps might be just right for the cloud Developing an App for deploying branding elements can get kind of complex, considering the scenarios for creating ...


2

Two things; firstly, you're not creating a page based on a masterpage. The masterpage is set at the web level, not at the page level. What you're likely seeing is that the page layout you're using for the page doesn't contain any editable regions within SharePoint Designer, thus it wants you to put it into edit mode. Most of the time you're going to create a ...



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