Thursday, February 27, 2014

Ratings Control SharePoint 2013 On-Prem

Adding ratings control in SharePoint 2013 on-premise requires going via Design Manager.

Here is the process:

  • Publishing Feature should be turned active.
  • Pages library should be provisioned
  • Go to Library Settings as in the image and make changes.
  • Once Ratings have been turned on, open your custom master page/page layout via Design manager to add this code.
  • Add this code inside the Head section
<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<%@ Register TagPrefix="SharePointPortalControls" Namespace="Microsoft.SharePoint.Portal.WebControls"  Assembly="Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>-->
  • Add this code where you want to display the average ratings
 <--<div class="article-content" align="left" style="left:0px; width:100px">
            <!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<SharePointPortalControls:AverageRatingFieldControl 
   ID="PageRatingControl" 
   FieldName="AverageRating" 
   runat="server"/>-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->
           </div>-->

Monday, August 19, 2013

How Storage Metrics delivers size of content especially in o365?

SharePoint 2013 introduces Storage Metrics Page for monitoring consumption of storage. This can be used by Site Collection Admins. This is a pretty decent tool especially when it comes to o365.

In SharePoint online, you don't have the ability to use run these commands the Get-SPDatabase or Get-SPContentDatabase as they are not available. You also don't have the ability to access SQL Server to check the size of content database.

Your first choice is to use a tool/webservice to download the entire site collection and then check the size. This is not the best use of any given tool or worth writing a service for.

This is the best way to get the size of the content. Site Settings->Storage Metrics and you could get data like below and using simple Math you could get fairly accurate estimate of the size of content.

% of Parent Size * X = Total Size

75.27/100*X = 181.5

i.e 181.5 * 100/75.27 = (Total Size of Content)











Monday, July 15, 2013

Annoying things of SharePoint Online (Design Limitations)




·         You have no access to ULS Logs. (You would have to work with support and send them the co-relation ID to get back the entry. This does not occur instantly)



·         All emails that coming from SP will come from this email address: no-reply@sharepointonline.com.  You cannot change this!



·         MSFT does not offer premium support for SharePoint Online.

Wednesday, May 15, 2013

Date Conversions/Calculated Fields - SP List

If you need to convert Article Date = '01/01/2013' to 'January 2013, you need to do the following
  • Add a new column to SP List
  • The type of the column is calculated.
  • Insert this formula to get the desired out come. [=TEXT([Article Date],"mmmm")&" "&TEXT([Article Date],"yyyy")]
If you need to convert Article Date = '01/01/2013' to '01 January', you need to do the following:

  • Follow steps 1&2
  • =TEXT(MONTH([Article Date]),"00")&" "&TEXT([Article Date],"mmmm")

Sunday, May 12, 2013

Display Content Editor WebPart only when it contains Content.

  • Define a Page Layout
  • Add a class to the section. - (Example: mainLayout)
  • Add another class to wrap a CE in this section. - (Example: controlContainer)
  • If there is a line break after the page layout, add an id to that control (Example: <BR Id='lineBreak' />
  • Here is the code to add to you .JS file.
        if ($('#mainLayout.controlContainer').length == 0)
        {
            $('#mainLayout').addClass('hidden');
            $('#lineBreak').addClass('hidden');
        };
   
   
        loadedStylesheets = document.styleSheets;
   
        for (var i in loadedStylesheets)
        {
            var findEditStyle = "https://SERVER/Style%20Library/en-US/Themable/Core%20Styles/editmode15.css"
                if (findEditStyle == loadedStylesheets[i].href)
                {
                    $('#mainLayout').removeClass('hidden');
                    $('#lineBreak').removeClass('hidden');
                };
           
        }

Using Jquery to determine Page in Edit Mode O365

If you have a scenario where you need to determine if the page is edit mode and display a control/container. Here is the approach

  • Define the container with a unique ID/Class
  • Add JQuery to some .js file.
  • Ensure that editmode15.css is loaded in one of the edit panels of the page layout associated with this page. Alternatively, you could also add something else in an edit panel and then check that going through the DOM object.
  • Then, add code like below.
        loadedStylesheets = document.styleSheets;
   
        for (var i in loadedStylesheets)
        {

            var findEditStyle = "https://SERVER/Style%20Library/en-US/Themable/Core%20Styles/editmode15.css"
                if (findEditStyle == loadedStylesheets[i].href)
                {
                    $('#YourID').removeClass('hidden');
                    $('#YourExtraIDs').removeClass('hidden');
                };
           
        }

Determine if

//Hiding the News From Leaders Section and making it visible in Edit Mode.
        /*
        check to see if WPEditModev4.css is loaded
        if so, this means you're in "edit" mode
        */
        // check to see if no news elements exist in 'News From Our Leaders' section
        if ($('#nLeader .articleContainer').length == 0)
        {
            $('#nLeader').addClass('hidden'); // hide the parent container if no articles
            $('#LeaderBreak').addClass('hidden');
        };
   
   
        loadedStylesheets = document.styleSheets;
   
        for (var i in loadedStylesheets)
        {
            //This path would be fixed as this is being loaded from the page layout.
            var findEditStyle = "https://yumbrandsinc.sharepoint.com/sites/ynn/Style%20Library/en-US/Themable/Core%20Styles/editmode15.css"
            var findStylesheet = "WPEditModev4.css";
                //var currentStylesheet = (loadedStylesheets[i].href.match(/\/([^/]+)$/)[1]);
                if (findEditStyle == loadedStylesheets[i].href)
                {
                    $('#nLeader').removeClass('hidden');
                    $('#LeaderBreak').removeClass('hidden');
                };
           
       

Monday, May 6, 2013

Hide Office365 Logo on SP 2013 sites

Comment the following line in the master page:
                    <!--<SharePoint:DelegateControl id="ID_SuiteBarBrandingDelegate" ControlId="SuiteBarBrandingDelegate" runat="server" />-->

If the above approach does not work, you could use CSS to hide.