Skip to main content

XrmToolBox: AutoNumberUpdater - new StateCode filter

SharePoint 2013 Minimal Master Page for lists and libraries

In order to embed a SharePoint 2013 list or document library into another web application via iframe I had to create a custom master page that is very slick, basically a new minimal master page for list and libraries.

The results looks like this:


The difficult part was to figure out which part (placeholders and other controls) of the original seattle.master which I used as template, I could remove or not.



<%@Master language="C#"%>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/15/Welcome.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<SharePoint:SPHtmlTag dir="<%$Resources:wss,multipages_direction_dir_value%>" ID="SPHtmlTag" runat="server" >
<head runat="server">
    <meta name="GENERATOR" content="Microsoft SharePoint" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=10"/>
    <meta http-equiv="Expires" content="0" />
    <SharePoint:SPPinnedSiteTile runat="server" TileUrl="/_layouts/15/images/SharePointMetroAppTile.png" TileColor="#0072C6" />
    <SharePoint:RobotsMetaTag runat="server"/>
    <SharePoint:PageTitle runat="server">
        <asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server">
            <SharePoint:ProjectProperty Property="Title" runat="server" />
        </asp:ContentPlaceHolder>
    </SharePoint:PageTitle>
    <SharePoint:SPShortcutIcon runat="server" IconUrl="/_layouts/15/images/favicon.ico?rev=23" />
    <SharePoint:StartScript runat="server" />
    <SharePoint:CssLink runat="server" Version="15"/>
    <SharePoint:CacheManifestLink runat="server"/>
    <SharePoint:ScriptLink language="javascript" name="core.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:ScriptLink language="javascript" name="menu.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:ScriptLink language="javascript" name="callout.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:ScriptLink language="javascript" name="sharing.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:ScriptLink language="javascript" name="suitelinks.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:CustomJSUrl runat="server" />
    <SharePoint:SoapDiscoveryLink runat="server" />
    <SharePoint:AjaxDelta id="DeltaPlaceHolderAdditionalPageHead" Container="false" runat="server">
        <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />
        <SharePoint:DelegateControl runat="server" ControlId="AdditionalPageHead" AllowMultipleControls="true" />
        <asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat="server" />
    </SharePoint:AjaxDelta>
    <SharePoint:CssRegistration Name="Themable/corev15.css" runat="server" />
</head>
<body>
  <SharePoint:ImageLink runat="server"/>
  <SharePoint:SPNoScript runat="server"/>
  <SharePoint:SPClientIDGenerator runat="server" ServerControlID="DeltaPlaceHolderMain;DeltaPlaceHolderPageTitleInTitleArea;DeltaPlaceHolderUtilityContent" />
  <SharePoint:SharePointForm runat="server" onsubmit="if (typeof(_spFormOnSubmitWrapper) != 'undefined') {return _spFormOnSubmitWrapper();} else {return true;}">
    <script type="text/javascript"> var submitHook = function () { return false; }; theForm._spOldSubmit = theForm.submit; theForm.submit = function () { if (!submitHook()) { this._spOldSubmit(); } }; </script>
    <SharePoint:AjaxDelta id="DeltaSPWebPartManager" runat="server">
        <WebPartPages:SPWebPartManager runat="Server" />
    </SharePoint:AjaxDelta>
    <asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />
    <SharePoint:AjaxDelta id="DeltaDelegateControls" runat="server">
        <SharePoint:DelegateControl runat="server" ControlId="GlobalNavigation" />
        <SharePoint:DelegateControl ControlId="GlobalSiteLink3" Scope="Farm" runat="server" Visible="false" />
    </SharePoint:AjaxDelta>
<div id="TurnOnAccessibility" style="display:none" class="s4-notdlg noindex">
    <a id="linkTurnOnAcc" href="#" class="ms-accessible ms-acc-button" onclick="SetIsAccessibilityFeatureEnabled(true);UpdateAccessibilityUI();document.getElementById('linkTurnOffAcc').focus();return false;"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,master_turnonaccessibility%>" EncodeMethod="HtmlEncode"/></a>
</div>
<div id="TurnOffAccessibility" style="display:none" class="s4-notdlg noindex">
    <a id="linkTurnOffAcc" href="#" class="ms-accessible ms-acc-button" onclick="SetIsAccessibilityFeatureEnabled(false);UpdateAccessibilityUI();document.getElementById('linkTurnOnAcc').focus();return false;"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,master_turnoffaccessibility%>" EncodeMethod="HtmlEncode"/></a>
</div>
<div class="s4-notdlg s4-skipribbonshortcut noindex">
    <a href="javascript:;" onclick="document.getElementById('startNavigation').focus();" class="ms-accessible ms-acc-button" accesskey="<%$Resources:wss,skipribbon_accesskey%>" runat="server"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,skipRibbonCommandsLink%>" EncodeMethod="HtmlEncode"/></a>
</div>
<div class="s4-notdlg noindex">
    <a href="javascript:;" onclick="document.getElementById('mainContent').focus();" class="ms-accessible ms-acc-button" runat="server"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,mainContentLink%>" EncodeMethod="HtmlEncode"/></a>
</div>
<div id="TurnOffAnimation" style="display:none;" class="s4-notdlg noindex">
    <a id="linkTurnOffAnimation" href="#" class="ms-accessible ms-acc-button" onclick="ToggleAnimationStatus();return false;"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,master_disableanimation%>" EncodeMethod="HtmlEncode"/></a>
</div>
<div id="TurnOnAnimation" style="display:none;" class="s4-notdlg noindex">
    <a id="linkTurnOnAnimation" href="#" class="ms-accessible ms-acc-button" onclick="ToggleAnimationStatus();return false;"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,master_enableanimation%>" EncodeMethod="HtmlEncode"/></a>
</div>
<a id="HiddenAnchor" href="javascript:;" style="display:none;"></a>
        <div id="ms-hcTest"></div>
        <div id="s4-ribbonrow" style="display:none">
        <div id="globalNavBox" class="noindex">
<div id="ribbonBox">
    <div id="s4-ribboncont">
        <SharePoint:AjaxDelta id="DeltaSPRibbon" BlockElement="true" runat="server">
            <SharePoint:DelegateControl runat="server" ID="GlobalDelegate0" ControlId="GlobalSiteLink0" />
            <SharePoint:SPRibbon
                runat="server"
                PlaceholderElementId="RibbonContainer"
                CssFile="" >
                <SharePoint:SPRibbonPeripheralContent
                    runat="server"
                    CssClass="ms-core-defaultFont ms-dialogHidden"
                    Location="TabRowLeft">
                </SharePoint:SPRibbonPeripheralContent>
            </SharePoint:SPRibbon>
        </SharePoint:AjaxDelta>
    </div>
    <SharePoint:AjaxDelta id="DeltaSPNavigation" runat="server">
        <asp:ContentPlaceHolder ID="SPNavigation" runat="server">
            <SharePoint:DelegateControl runat="server" ControlId="PublishingConsole" Id="PublishingConsoleDelegate" />
        </asp:ContentPlaceHolder>
    </SharePoint:AjaxDelta>
</div>
<SharePoint:AjaxDelta id="DeltaWebPartAdderUpdatePanelContainer" BlockElement="true" CssClass="ms-core-webpartadder" runat="server">
  <div id="WebPartAdderUpdatePanelContainer">
    <asp:UpdatePanel
        ID="WebPartAdderUpdatePanel"
        UpdateMode="Conditional"
        ChildrenAsTriggers="false"
        runat="server">
      <ContentTemplate>
        <WebPartPages:WebPartAdder ID="WebPartAdder" runat="server" />
        </ContentTemplate>
      <Triggers>
        <asp:PostBackTrigger ControlID="WebPartAdder" />
      </Triggers>
    </asp:UpdatePanel>
  </div>
</SharePoint:AjaxDelta>
        </div>
        </div>
        <div id="s4-workspace" class="ms-core-overlay">
        <div id="s4-bodyContainer">
        <SharePoint:AjaxDelta BlockElement="true" id="DeltaPlaceHolderPageDescription" CssClass="ms-displayInlineBlock ms-normalWrap" runat="server">
    <a href="javascript:;" id="ms-pageDescriptionDiv" style="display:none;">
      <span id="ms-pageDescriptionImage">&#160;</span>
    </a>
    <span class="ms-accessible" id="ms-pageDescription">
      <asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat="server" />
    </span>
    <SharePoint:ScriptBlock runat="server">
      _spBodyOnLoadFunctionNames.push("setupPageDescriptionCallout");
    </SharePoint:ScriptBlock>
  </SharePoint:AjaxDelta>
        <div id="contentRow" style="padding-top: 0px">
  <SharePoint:AjaxDelta id="DeltaPlaceHolderLeftNavBar" BlockElement="true" CssClass="ms-core-navigation" role="navigation" runat="server">
    <asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">
                <a id="startNavigation" name="startNavigation" tabIndex="-1"></a>
                <asp:ContentPlaceHolder id="PlaceHolderLeftNavBarTop" runat="server" />
                <asp:ContentPlaceHolder id="PlaceHolderQuickLaunchTop" runat="server" />
                <asp:ContentPlaceHolder id="PlaceHolderLeftNavBarDataSource" runat="server" />
                <asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat="server" />
                <asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server" />
    </asp:ContentPlaceHolder>
  </SharePoint:AjaxDelta>
<div id="contentBox" aria-live="polite" aria-relevant="all" style="margin-left:1px;min-width:1px">
  <div id="notificationArea" class="ms-notif-box"></div>
    <SharePoint:AjaxDelta id="DeltaPageStatusBar" BlockElement="true" runat="server">
        <div id="pageStatusBar"></div>
    </SharePoint:AjaxDelta>
    <SharePoint:AjaxDelta id="DeltaPlaceHolderMain" BlockElement="true" IsMainContent="true" runat="server">
        <a id="mainContent" name="mainContent" tabindex="-1"></a>
        <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />
    </SharePoint:AjaxDelta>
</div>
<SharePoint:AjaxDelta id="DeltaFormDigest" BlockElement="true" runat="server">
    <asp:ContentPlaceHolder id="PlaceHolderFormDigest" runat="server">
        <SharePoint:FormDigest runat="server"/>
    </asp:ContentPlaceHolder>
</SharePoint:AjaxDelta>
<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderPageImage" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderTitleLeftBorder" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderMiniConsole" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderTitleRightMargin" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaSeparator" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderNavSpacer" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarBorder" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderBodyLeftBorder" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderBodyRightMargin" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderGlobalNavigation" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="PlaceHolderGlobalNavigationSiteMap" runat="server" Visible="false" />
<asp:ContentPlaceHolder id="WSSDesignConsole" runat="server" Visible="false" />
        </div>
        </div>
        </div>
</SharePoint:SharePointForm>
    <SharePoint:AjaxDelta id="DeltaPlaceHolderUtilityContent" runat="server">
        <asp:ContentPlaceHolder id="PlaceHolderUtilityContent" runat="server"/>
    </SharePoint:AjaxDelta>
    <SharePoint:ScriptBlock runat="server">
        var g_Workspace = "s4-workspace";
    </SharePoint:ScriptBlock>
</body>
</SharePoint:SPHtmlTag>

Comments

  1. Or, you could just append ?IsDlg=1 to the end of your lists pages and SharePoint will display a minimal version for you. No need for master page hacks ;)

    ReplyDelete
  2. "Generators empower endless possibilities, seamlessly converting energy into action with efficiency and innovation."Generator

    ReplyDelete

Post a Comment

Popular posts from this blog

Yet Another Address Autocomplete PCF Control–powered by Bing

In this blog post I will not go into detail in how to install all the pre-requisites that are required to build and run PCF controls. My goal was to build a new PCF control and get into coding of PCF controls as fast as possible. Here are a few links to articles that will help you installing the pre-requisites (Microsoft PowerApps CLI)  https://docs.microsoft.com/en-us/powerapps/developer/component-framework/get-powerapps-cli Other good references to get into this topic: https://toddbaginski.com/blog/how-to-create-a-powerapps-pcf-control/ https://docs.microsoft.com/en-us/powerapps/developer/component-framework/create-custom-controls-using-pcf I looked through the Guido Preite’s https://pcf.gallery/ which will help you find appropriate use cases / examples for your own needs. It did not take very long to find a simple example to start with: Andrew Butenko's https://pcf.gallery/address-autocomplete/ A few moments later I had the idea to create yet another address autocomplete...

Regarding SPFieldMultiLineText (Add HTML/URL content to a field) programmatically

I recently tried so set some HTML content in a SharePoint list column of type SPFieldMultiLineText. My first approach was this piece of code: SPFieldMultiLineText field = item.Fields.GetFieldByInternalName( "Associated Documents" ) as SPFieldMultiLineText; StringBuilder docList = new StringBuilder(); docList.Append( " " ); foreach (DataRow docRow in addDocs) { DataRow[] parent = dr.Table.DataSet.Tables[0].Select( "DOK_ID=" + docRow[ "DOK_MGD_ID" ].ToString()); if (parent != null && parent.Length > 0) { docList.AppendFormat( " {1} " , parent[0][ "FilePath" ].ToString(), parent[0][ "Title" ].ToString()); } } if (docList.Length > 0) { // remove trailing tag docList.Remove(docList.Length-5, 5); } docList.Append( " " ); string newValue = docList.ToString(); item[field.Title] = newValue; What this code does is to get all associated documents to the main document and to add these docu...

XrmToolBox: AutoNumberUpdater - new StateCode filter

Mayank Pujara's AutoNumberUpdater plugin for the XrmToolBox is a great tool to add missing auto number values to an auto number field for an entity/table. In his blog you can find more details about the original version of his plugin: https://mayankp.wordpress.com/2021/12/09/xrmtoolbox-autonumberupdater-new-tool/ For my purposes I had to update accounts with missing account numbers, but in my use case this should only be done for those accounts that have the status value "Active".   As this plugin did not have this feature I quickly implemented it and Mayank merged my changes to his plugin source code. You can download the new version 1.2024.0.1 in the Tool Library of the XrmToolBox.