What is Less.js ?

Less is amazing little tool and followed by reusable and dynamic approach.
Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques that allow you to make CSS that is more maintainable, themable and extendable.

Less.js has feature like :-
1.  Variables
2.  Operations
3. Mixims

We can download Less.js  from : http://lesscss.org/#download-options and Add as reference


Declare Variables:-


Deaclare Operation:-

It just like any programming language
@boxHeight:200px
@boxWidht: @boxHeight*2

Declare Mixins:-

Mixins allow you to embed all the properties of a class into another class by simply including the class name as one of its properties.

.RoundBorders {
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
}
Make it argument able:-
.RoundBorders (@radius) {
  border-radius: @radius;
  -moz-border-radius: @radius;
  -webkit-border-radius: @radius;
}
header {
  .RoundBorders(4px);
}

.button {
  .RoundBorders(6px);
}

What is CDN Fallback ?


CDN stands for Content Delivery Network.

The benefit of loading libraries like jQuery and Bootstrap from a CDN is that If Server is located multiple geographical location. It read or load the files from the nearest server, which ultimately speed up the page response time. example:-






There are 2 popular CDN exists in the market  
1. Google  
2. Microsoft 

Google CDN:- https://developers.google.com/speed/libraries/


<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>

Microsoft CDN:- http://www.asp.net/ajax/cdn
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
Fallback means :- If CDN server fails then WHAT ?

In that scenario, It should read from your local server i.e.

<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.0.min.js"></script>
<script>
if (typeof jQuery == 'undefined') {
    document.write(unescape("%3Cscript src='/js/jquery-2.0.0.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>

Or (Another Way) :: Both are same

<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.0.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-2.0.0.min.js">\x3C/script>')</script>






What is JavaScript , JQuery and DOM ?

In very Short and Simplified manner:-

JavaScript is Language.

JQuery is Library or Framework or Reusable which is built on top of JavaScript.

Basically JQuery works with 3-S i.e. Start ($), Selector (“.” or “#”) and Shot (Action i.e. Click or Val etc.)


 DOM  (Document Object Model ) - It is representation of HTML document  or piece of Web Page or HTML Content exist in the Web page having tags like <Div>, <P>, <Span>, <UI>, <LI> etc..
DOM is like standard object which consist HTML elements properties, HTML elements methods, HTML elements events
DOM - In-Memory representation of HTML
High Level structure of DOM:






   

SharePoint 2013: How to add people search result in to different verticals

Everything Verticals does not show the people result.
Reason System have different result source for different verticals or Navigation.We can define or add multiple result source data under one verticals.
- Everything (Vertical) have default Result Source: i.e. Local SharePoint Results
- People (Vertical)  have default Result source: i.e. Local People Results

Using Query Rule we can add People result into Everything

Steps are as follows:-

Step1:-

Search Center -> Site settings -> Site Collection Administration -> Search Query Rules:

Step2:
 Select Local SharePoint Results (System) in the Context drop-down:



Step3:-
Once that is selected, click on New Query Rule:


 Step4:-
On the Add Query Rule page, add a rule name, remove the condition, and then click on the Add Result Block link:





On the Add Result Block page change the Title to state "People Results". In the Select this Source, select Local People Results (System) and select the amount of items. The default is 2 and that's probably not enough (just like beer or martinis). 3 or 5 seem like good numbers.



Under the Settings section, as shown above, select the "More" link option and enter "peopleresults.aspx?k={subjectTerms}". Select People Item from the Item Display Template. Click OK.



Back on the Add Query Rule page, click Save.

Run your search again (it may take a moment for the changes to appear):





Happy Coding !!

SharePoint 2013 Site Collection deletion and restore options


In this post I want to review PowerShell Commands available for managing Site Collections to do operations like delete, restore-deleted and remove-deleted, viz., Remove-SPSite, Restore-SPDeletedSite, Remove-SPDeletedSite. I will also be reviewing differences in deleting Site Collection from Central Admin feature against using PowerShell commands with and without using -gradualdelete option.



Deleting Site Collection from Central Admin:




The Site Collection deletion action from central admin will not permanently delete the Site Collection but it will only be marked as deleted in the Site map table in the Configuration Database.


The Central admin deletion of Site Collection is same as deleting site using PowerShell Command with gradualdelete option.
Example:


If you run the following SQL Query against configuration database you will find the delete transaction id for the deleted site. (Please note that, since is a lab exercise I took liberty to execute query against a SharePoint Database. Querying SharePoint database is not supported by Microsoft)






This deleted Site Collection will only get deleted permanently only when the Timer Job for ‘Gradual Site Delete’ for that specific Web Application is ran as per schedule.



Before the timer-job is ran, the deleted site collection, can be found in the deleted Sites Collections list using the command Get-SPSiteDeleted.





If deleted site still exist in the deleted site list, then it can be restored successfully using Restore-SPDeletedSite





After restore, the Site Collection can be seen back at the same place where it was before deletion.





Remove-SPDeletedSite

Let’s redo the deletion as a -gradualdelete and then perform removing site permanently from the SharePoint Farm (from Site Map).




Verify in Site Map Table in Config Database.

No record of the site


Using 'Remove-SPSite' without using option 'gradualdelete'. (Deleting the Site Permanently).


If site is deleted using PowerShell with Remove-SPSite without gradualdelete option, then the site gets deleted permanently from the farm configuration - it can not be restored.


Remove-SPSite –Identity "http://test.sp2013.corp/Sites/SiteABC"



“Gradual Site Delete” Timer-Job


However the site may have got deleted permanently from the SharePoint Farm, and confirmed as per information in “Site Map” table, and even it can not be restored further, the Content Database only get back the deleted site space only after the ‘Gradual Site Delete’ timer-job is ran.


Ref: http://blogs.technet.com/b/wbaer/archive/2010/08/02/gradual-site-delete-in-sharepoint-2010.aspx

Provisioning CEWP on Share Point Pages


Project Structure:-

1. Add Default Data to Content Editor Web Part

Create any Pages in Solution and Add necessary tag:-


<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
<SharePoint:ListItemProperty Property="BaseName" maxlength="40" runat="server" />
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<meta name="GENERATOR" content="Microsoft SharePoint" />
<meta name="ProgId" content="SharePoint.WebPartPage.Document" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="CollaborationServer" content="SharePoint Team Web Site" />

</asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

<WebPartPages:WebPartZone runat="server" title="loc:TitleBar" id="TitleBar" AllowLayoutChange="false" AllowPersonalization="false" Style="display:none;" >

 </WebPartPages:WebPartZone>

</asp:Content>


Add XML tag in Element File with C-Data tag

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="TestModule" Url="SitePages">

    <File Path="TestModule\asas.aspx" Url="TestModule/asas.aspx" Type="GhostableInLibrary"  >
      <Property Name="Title" Value="CEWP- Provisioning"/>

      <AllUsersWebPart WebPartZoneID="TopZone" WebPartOrder="0">

        <![CDATA[<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">
                  <Title>Content Editor</Title>
                      <FrameType>Default</FrameType>
                      <Description>Allows authors to enter rich text content.</Description>
                      <IsIncluded>true</IsIncluded>
                      <ZoneID>TopZone</ZoneID>
                      <PartOrder>0</PartOrder>
                      <FrameState>Normal</FrameState>
                      <Height />
                      <Width />
                      <AllowRemove>true</AllowRemove>
                      <AllowZoneChange>true</AllowZoneChange>
                      <AllowMinimize>true</AllowMinimize>
                      <AllowConnect>true</AllowConnect>
                      <AllowEdit>true</AllowEdit>
                      <AllowHide>true</AllowHide>
                      <IsVisible>true</IsVisible>
                      <DetailLink />
                      <HelpLink />
                      <HelpMode>Modeless</HelpMode>
                      <Dir>Default</Dir>
                      <PartImageSmall />
                      <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
                      <PartImageLarge>/_layouts/15/images/mscontl.gif</PartImageLarge>
                      <IsIncludedFilter />
                      <Assembly>Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
                      <TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
                      <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
                      <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[ ​This is my test Content editor webpart ]]]]><![CDATA[></Content>
                      <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
                      </WebPart>]]>


      </AllUsersWebPart>
      
    </File>
  </Module>
</Elements>


2. Add HTML File link to Content Editor Web Part


Use above code as is and replace the Content Link tag with below mention setting.

Note:- here i am using HTML file reference from style library. 

 <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">~SiteCollection/Style%20Library/HTMLFiles/abc.html</ContentLink>