In office 365 environment, Microsoft had recommended not to customize the master pages. So to avoid customization, we can inject CSS at run time to Office 365 Master Pages. This can be achieved using the below CSOM Code in any provider hosted model app development. Basically we are creating Custom Action at run time and injecting CSS using custom actions.
/ /Build a custom action
UserCustomAction cssAction = web.UserCustomActions.Add();
//Adding SCript Link location
cssAction.Location = “ScriptLink”;
cssAction.Sequence = 100;
cssAction.ScriptBlock = @”document.write(‘<link rel=””stylesheet”” href=””” + assetLibrary.RootFolder.ServerRelativeUrl + @”/custom.css”” />’);”;
cssAction.Name = actionName;
// Apply the CSS injection
Do visit my other blogs on office365 below.
Hope this piece of code helps. Happy SharePointing 🙂