Solved

SharePoint Add-in: Get Rid of Microsoft Header

Posted on 2016-07-25
2
70 Views
Last Modified: 2016-07-25
I'm developing a SharePoint add-in with Visual Studio 2015 using JavaScript and want to remove the default headers/navigation Microsoft includes, specifically what's in the red box:

SP Add-In Default Header
I assume these are included via the default .aspx code which looks like:

<%-- The following 4 lines are ASP.NET directives needed when using SharePoint components --%>

<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %>

<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Open in new window


But I can't wholesale delete those lines without generating a page that simply doesn't run (error is 'An unexpected error has occurred').

What's the correct way to customize?

Thanks!

Michael
0
Comment
Question by:Michael Vasilevsky
2 Comments
 
LVL 9

Accepted Solution

by:
Paweł earned 500 total points
ID: 41727677
what you'll have to do is use CSS to hide it from the UI rather then remove it, now your sharepoint add in runs in an iFrame so i don't think you'll be able to it there without the iFrame trick (https://github.com/InstanceOfAnObject/IFrameOrchestrator) there I believe you'll be able to fire javascript from your add in into the host web that will then be able to update the css of your host page.

that or I think you can inject it into the page using the Script Editor webpart
https://sharepoint.protiviti.com/blog/Lists/Posts/Post.aspx?ID=169

with both you'll have to find the selector for the css container of what you want to hide
0
 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 41728848
I suspected using CSS to hide is the approach - thanks for the info. Below is the CSS I added for anyone interested:

#globalNavBox {
    display: none !important;
}

#suiteBarDelta {
    display: none !important;
}

Open in new window


Thank you!

Michael
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question