Display rating control in xslt list view webpart after migration from SP2010 to SP2013

  Make sure you have Ratings setting enabled in your list/ library.   As the rating field is not shown properly;     Add below link for XSLT; <xsl:include href=”/_layouts/15/xsl/blog.xsl”/> <xsl:include href=”/_layouts/15/xsl/internal.xsl”/> <xsl:include href=”/_layouts/15/xsl/fldtypes_Ratings.xsl”/>   Add below code for Rating; <xsl:call-template name=”emit_RatingsInitialization”/> <xsl:apply-templates select=”$Fields[@Name=’AverageRating’]” mode=”PrintField”> <xsl:with-param name=”thisNode” select=”$thisNode”/> <xsl:with-param name=”Position” select=”$Position”/> </xsl:apply-templates>

Read More

SharePoint 2013 BreadCrumb On Master Page

Let’s bring the breadcrumb back to SharePoint 2013! By default SharePoint 2013 design manager  doesn’t have a breadcrumb snippet . If you are going to build master page for sharepoint 2013 and wants breadcrumb in your master page, this was a very helpful feature to navigate back in your site and some users really miss it. You have to just paste the given bellow code in your master page where you want to show- <div class=”ms-breadcrumb-box ms-tableCell ms-verticalAlignTop”> <div class=”ms-breadcrumb-top”> <div class=”ms-breadcrumb-dropdownBox” style=”display:none;”> <!–SPM:<SharePoint:AjaxDelta id=”DeltaBreadcrumbDropdown” runat=”server”>–> <!–SPM:<SharePoint:PopoutMenu Visible=”false” runat=”server” ID=”GlobalBreadCrumbNavPopout” IconUrl=”/_layouts/15/images/spcommon.png?rev=40″ IconAlt=”<%$Resources:wss,master_breadcrumbIconAlt%>” ThemeKey=”v15breadcrumb” IconOffsetX=”215″ IconOffsetY=”120″ IconWidth=”16″ IconHeight=”16″ AnchorCss=”ms-breadcrumb-anchor” AnchorOpenCss=”ms-breadcrumb-anchor-open” MenuCss=”ms-breadcrumb-menu ms-noList”>–> <div class=”ms-breadcrumb-top”> <!–SPM:<asp:Label runat=”server” CssClass=”ms-breadcrumb-header” Text=”<%$Resources:wss,master_breadcrumbHeader%>”/>–> </div> <!–SPM:<asp:ContentPlaceHolder id=”PlaceHolderTitleBreadcrumb” runat=”server”>–> <!–SPM:<SharePoint:ListSiteMapPath runat=”server” SiteMapProviders=”SPSiteMapProvider,SPContentMapProvider” RenderCurrentNodeAsLink=”false” PathSeparator=”” CssClass=”ms-breadcrumb” NodeStyle-CssClass=”ms-breadcrumbNode” CurrentNodeStyle-CssClass=”ms-breadcrumbCurrentNode” RootNodeStyle-CssClass=”ms-breadcrumbRootNode” NodeImageOffsetX=”0″ NodeImageOffsetY=”289″ NodeImageWidth=”16″ NodeImageHeight=”16″ NodeImageUrl=”/_layouts/15/images/fgimg.png?rev=40″ RTLNodeImageOffsetX=”0″ RTLNodeImageOffsetY=”312″ RTLNodeImageWidth=”16″ RTLNodeImageHeight=”16″ RTLNodeImageUrl=”/_layouts/15/images/fgimg.png?rev=40″ HideInteriorRootNodes=”true” SkipLinkText=””/>–> <!–SPM:</asp:ContentPlaceHolder>–> <!–SPM:</SharePoint:PopoutMenu>–> <!–SPM:</SharePoint:AjaxDelta>–> </div> <!–SPM:<SharePoint:AjaxDelta id=”DeltaTopNavigation” BlockElement=”true” CssClass=”ms-displayInline” runat=”server”>–> <!–SPM:<SharePoint:DelegateControl runat=”server” ControlId=”TopNavigationDataSource” Id=”topNavigationDelegate”>–> <!–SPM:<Template_Controls>–> <!–SPM:<asp:SiteMapDataSource ShowStartingNode=”False” SiteMapProvider=”SPNavigationProvider” id=”topSiteMap” runat=”server” StartingNodeUrl=”sid:1002″/>–> <!–SPM:</Template_Controls>–> <!–SPM:</SharePoint:DelegateControl>–> <!–SPM:<asp:ContentPlaceHolder id=”PlaceHolderTopNavBar” runat=”server”>–> <!–SPM:<SharePoint:AspMenu ID=”TopNavigationMenu” Runat=”server” EnableViewState=”false” DataSourceID=”topSiteMap” AccessKey=”<%$Resources:wss,navigation_accesskey%>” UseSimpleRendering=”true” UseSeparateCss=”false” Orientation=”Horizontal” StaticDisplayLevels=”2″ AdjustForShowStartingNode=”true” MaximumDynamicDisplayLevels=”2″ SkipLinkText=””/>–> <!–PS: Start of READ-ONLY PREVIEW (do not modify)–><link rel=”stylesheet” type=”text/css”… Read More

Read More

Bulk delete SharePoint List items using CSOM

SharePoint CSOM enables us to delete bulk list items using browser console. Scenario-1:  We have a list of records to be deleted from a SharePoint list and we do not want to delete record one by one. Scenario-2:  We want to delete the list and list already had cross the threshold limit and not allowing to delete list until records reaches under the threshold limit. Following script demonstrates the steps to achieve the same Step-1:  Navigate to SharePoint site where list is present. Step-2: Open Inspect Element by clicking F12 in any browser. Open console tab. Step-3: Copy and Paste following code in console, Insert the list name (wherever ‘ListName’ is mentioned) and run the command. // ————————————— var clientContext; var website; var oList; var cnt = 0; // Make sure the SharePoint script file ‘sp.js’ is loaded before your code runs. SP.SOD.executeFunc(‘sp.js’, ‘SP.ClientContext’, sharePointReady); // Create an instance of the current context. function sharePointReady() { clientContext = SP.ClientContext.get_current(); website = clientContext.get_web(); oList = website.get_lists().getByTitle(‘ListName’); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml(‘1000’); this.collListItem = oList.getItems(camlQuery); clientContext.load(website); clientContext.load(collListItem, ‘Include(Id)’); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));… Read More

Read More

To set custom sub site icon in a custom master page.

I.e. For Sub Site – A: . For Sub Site – B: Below is the approach followed from me: Added below entry in master page but it was always resulting in wrong URL (404 URL not found) and referring to Site Collection URL (It was needed to refer sub site URL) <asp:Image runat=”server” id=”idMainSubSiteImageLink” CssClass=”subSiteIconData” ImageUrl=”../../SiteAssets/banner.png”></asp:Image> 2    I have used trick to resolve correct URL by following steps below: -Added entry of View All Site Contents from SharePoint, It’s NavigateUrl part gets converted to href with correct sub site URL. <SharePoint:SPLinkButton id=”idNavLinkViewAll1123″ CssClass=”subSiteIcon”  runat=”server” NavigateUrl=”~site/SiteAssets/banner.png” Text=””/> -Added below JavaScript to apply correct URL to Image link mentioned above and made SPLink hidden <script type=”text/javascript”>_spBodyOnLoadFunctionNames.push(“setImageSrc”);function setImageSrc() { var tempImageSrc = document.getElementById(“ctl00_idNavLinkViewAll1123”).getAttribute(“href”); document.getElementById(“ctl00_idMainSubSiteImageLink”). setAttribute(“src”,tempImageSrc); } </script> <style type=”text/css”> .subSiteIcon {display:none;} </style> – Now, it automatically applies proper image as per sub site user is navigating on.

Read More