Tag Info

Hot answers tagged

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

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


5

The preferred way now to reference styles in SharePoint 2013 is to upload them to the master page gallery, you can create a folder in your master page gallery and upload your CSS file there either manually or using a module in Visual Studio. Once you do so, you can refernce it using : <SharePoint:CssRegistration name="&lt;% ...


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

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

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

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

You can do so by changing the CSS for that control. The control is implemented differently in On Premise than O365, so here's how to change it in both scenarios: Office 365: .o365cs-base.o365cst .o365cs-topnavBGColor, .o365cs-base.o365cst .o365cs-topnavLinkBackground{ background-color: red; } This is to change it to red color for example. In an on ...


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

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

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


2

The relationship between .html and .master is a bridge. It has been implemented so that developers who are not familiar with ASP.NET masterpages and SharePoint can use the .html file to do the changes in a "environment" they are more or less familiar with. I'm going to assume this is an on-premise solution, so yes, downloading and putting the .js file in ...


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

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

Your user control needs to target a delegate control placed in the page body not AdditionalPageHead. AdditionalPageHead targets the html head element and is used for adding additional things to the head, like css and javascript files. A delegate control in the body is the appropriate place for an asp:button to live. So within the masterpage, you would ...


2

I tried the following inside a custom css file, but this will only remove the “Documents” text , but not the whole row. Looking at your CSS, this is because you are only removing the three table cells but not the actual row, which is what you want to remove. You should be able to accomplish this using the jquery .parent() selector (since the TR does ...


2

Turns out that when I was saving a site as a template, SharePoint forgot to put the CustomMasterUrl attribute into the configuration section of the ONet.xml file. I had to export the site template (as a WSP file) and import that file into Visual Studio 2010. Then I added the missing attribute, so the full string was as follows: <Configuration ID="0" ...


2

You can't really get the SharePoint master page, but you can inherit the look and feel of SharePoint by using the 'Chrome Control'. Here's a walkthrough: http://msdn.microsoft.com/en-us/library/office/fp179916(v=office.15).aspx


2

A Site Collection cannot have a Parent Site Collection, A Site Collection can only have child Sub-Sites. So to answer your questions: 'test.mycompany.net' is not a parent to the other site collections. It didn't inherit because there is no parent-child relationship. Only subsites would be able to inherit the masterpage. In order to 'share' a ...


2

You can't change the .master file when it's bound like this, you can only edit the .html file. It will re-generate the .master when you save the .html. This is due to the Design Manager packet in SP2013. Here's the MSDN article on this feature set: http://msdn.microsoft.com/en-us/library/office/jj822363(v=office.15).aspx


2

There is no explicit DENY when it comes to SharePoint permissions. In this case I would not use that particular group. I would create a new SharePoint group with all of the same members minus the individual(s) you do not want to have access to that page. I would stay away from assigning individual permissions on a user-to-user basis. You are absolutely ...


2

Page Title is rendered as Try this .ms-core-pageTitle { font-size:2.77em; white-space:nowrap; color:pink; /*Let us test colour*/ font-size:9.77em;/*make it huge*/ /*You edits here*/ } Override the above in you master page or custom css file.


2

Since you are using SharePoint 2013, you can either use JSOM or REST API to read the data. This is happening on the client side, and it will be easier to add it to respective DOM elements (or create new elements). JSLink is a good option, but implementation will take more time. I prefer REST as it's much easier to implement and performs better.


2

I would go for a User control with server side code. The UC can read from a list you (or the user control itself) creates and then create HTML from that result. You can then style the HTML with CSS if needed I would use HttpCache or similar to cache the final HTML for as long time as you think is viable for your use case (note that an IISRESET will clear ...


2

You can edit the master page HTML file and then add your CSS & JS references. The best practice is to take a copy of seattle.html (html master page) and then work on that. SharePoint online refer custom css and javascript in MasterPage (Site Assets)


2

If you just want to add a custom CSS and JS to your master page, then instead of creating a new master page, try the following and check if it works for your purpose. For Custom CSS : Use the Alternate CSS Url to set a custom CSS File. For referring a custom JS file follow this approach - ...



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