Tag Info

Hot answers tagged

7

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

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


4

The master pages and page layouts are stored at site collection level and in master page gallery _catalogs/masterpage. But you can always have liberty to select different master page for each sub site or also inherit the master page from its parent which is a site collection. Webapplication won't have any master page for itself without a root site ...


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


3

Update an oslo.css is not recommendable approach because it can break other elements which you might not find even. You should check with developer tools about the CSS. Which CSS is breaking the layout and try to override that CSS with your custom CSS in the masterpage. Here is the great solution Responsive SharePoint available that you can use with ...


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

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

$siteUrl = "http://ukreddy:3456/" $siteCollection = Get-SPSite $siteUrl Enable-SPFeature "PublishingSite" -Url $siteCollection.Url -force Enable-SPFeature "PublishingWeb" -Url $siteCollection.Url -force http://ukreddysharepoint2010.blogspot.co.uk/2014/05/error-systemargumentexception-value.html Sharepoint was failing to activate the feature PublishingWeb. ...


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


2

Check if the safe control entry is there in the web.config, if not, add it, then the masterpage should work. Basically when you "edit" the masterpage you are unghosting it and that causes the Sharepoint to use type-safe parsers for all unghosted content.


2

using (var ctx = new ClientContext( url )) { var web = ctx.Web; var masterPageUrl = String.Format( "{0}/_catalogs/masterpage/SPCCapatech/FullWidth_SideBar.master", ctx.Web.ServerRelativeUrl ); web.MasterUrl = masterPageUrl; web.CustomMasterUrl = masterPageUrl; web.Update(); ctx.Load( web ); ctx.ExecuteQuery(); } ...



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