What is difference between AngularJS and Angular 2

AngularJS 1:

·         AngularJS is a structural Framework for dynamic web apps. It can be added to an HTML page with a <Script> tag.

·         It extends HTML attributes with directives & binds data to HTML with expressions.

·         It is fully open source & free to use.

AngularJS has different directives, provides various functionality in the application.

ng-app: This directive initializes an AngularJS application

Ex: <div ng-app = ""></div>

ng-model: This directive is used to bind the values from AngularJS application to HTML input controls.

Ex: <input type = "text" ng-model = "name">

ng-bind: This directive bind AngularJS application data into HTML tags.

Ex: <span ng-bind = "name"></span>

 ng-repeat: This directive is used to repeat html element.

Angular 2:

·         Angular 2 implements unidirectional tree based change detection which again increases performance.

·         It implements web standards like components, and it provides better performance than AnguarJS 1.

·         In Angular 2, local variables are defined using hash (#) prefix.

Ex: <div *ngFor="# customer in customers” >

Difference between AngularJS 1.x & Angular 2:

AngularJS 1 .x
Angular 2
It was not built with mobile support.
Mobile oriented
Languages support: ES5, Es6, and Dart.
More choice for language.
Languages support:  Es5, ES6, Typescript or Dart.
Easy to setup, we need to add reference of the library.
It is not easy to setup.It is dependent of other libraries and it requires some efforts to set up it.
Angular 1.x Controller:
var myApp = angular
.module("myModule", [])
.controller("productController", function($scope) {
         var prods = { name: "Prod1", quantity: 1 };
         $scope.products = prods;
Controllers are replaced with Components
Angular 2 Components using Typescript:
import { Component } from '@angular/core';
    selector: 'prodsdata',
    template: '<h3>{{prods.name}}</h3>'
export class ProductComponent {
    prods = {name: 'Prod1', quantity: 1 };
Structural Directives
   <li ng-repeat="technology in technologies">
Structural Directives
  <li *ngFor="#technology of technologies">
Asterisk (*) sign is used as prefix for structural directives & camel case syntax is used.
It is not used camel case syntax for built-in directives.
ng-class, ng-model
Uses camel case syntax for built-in directives.
ngClass , ngModel
Angular 1 not directly used valid HTML DOM element properties and events.
ng-href , ng-src, ng-show & ng-hide
ng-click, ng-blur
<button ng-click=”Showdata()”>
Directly uses the valid HTML DOM element properties and events.
href, src & hidden
<button (click) =”Showdata()”>
ng-bind is used for One-way data binding directive
<input ng-bind=”my.name”></input>
One-way data binding directive replaced with [Property]
<button (click) = “showdata()”>
ng-model is used for two-way data binding
<input ng-model=”my.name”></input>
Two way data binding is replaced with [(ngModel)]
<input [(ngModel)]=”my.name”></input>
AngularJS 1.x using ng-app for Bootstrapping.
   angular.element(document).ready(function() {
      angular.bootstrap(document, ['myApp']);
Angular 2 using bootstrapping via code.
import { bootstrap } from 'angular2/platform/browser';
import { ProductComponent } from '-/product.component';

Get First release before public release in Office 365

We can get early updates before public release in Office 365, Office 365 team releasing the updates for two types of users.
Two types of User Releases:

1.       Standard Users
2.       First release Users
By default all users are selected under Standard user category. First release users will get the updates before the standard users.  We have to enable the first release feature. 

First Release Enable:

 Navigate to Office 365 Admin Center.

Click on “Settings” tab -> Organizational Profile. Admin only can view and manage the organization profile details.
By default it’s showing “Standard Release”  , click on “Edit” to change the Release track to “First release”
Here we can see two options for First release
First release for every one -> We can get updates for entire organization.
First release for selected users -> We have to pick people to preview the updates.
 Now am selecting “First release for selected users” then click “ Next”
Click “Yes” to update release for Select People.
          Click “Add People” to add people into Release preference.
We can add Multiple or single user here. Check the users and click Save.
                Click on Close to update list of Users.
Now, we can see First release on Release track.

Office365 UI New look on Site contents

New look for Site Content page

We can see 3 categories in Site contents
  1. Command bar
             We can create list, Document library, app and subsite. And we can check Recycle bin, Site Settings and manage Workflows

     2.  WebAnalytics Section

             In this section we can find Site Visits, Trending Content and also some tips to use this page.
  •    Site visits display the number of visits to your site within the last 7-day.
  •    Trending content displays the most popular content on your site for 2-week period.

     3.  Site Hub Contents

              Site Hub Contents will show lists & Libraries and Sub sites

PDF Method in K2 Blackpearl using K2 Designer

In K2 we have two options to send a mail with PDF.
1. Save as PDF Control
2. PDF Converter

Save as PDF Control:  We can use this control, when we have to create PDF has a same Form or View at a particular time when an event is executed.

PDF Converter:  If we want to create PDF file without opening the form or view, we can use this PDF Converter.
Example: Html or URL

The PDF Converter has three functions:
  • Create PDF from HTML (raw HTML to PDF Format)
  • Create PDF from URL (Captures a URL to PDF Format)
  • Create PDF from HTML or URL
HTML - Creates a PDF file at a certain point in time

URL - Creates a PDF file upon load of the page

These functions are available in the ServiceObject Explorer when creating an Advance SmartObject.

Create K2 PDF file using PDF Converter in an Advance SmartObject

 First we have to create Advance Smart Object , Check my previous  Article how to create PDF Converter Advance Smart Object.

You can see my Previous article 

How to generate Smart Forms in K2 for SharePoint list

Create Workflow using K2 designer , In the workflow wizard , drag our “PDF Converter” under Advance Smart Object.
It will open “Create PDF from URL” Wizard, Click “Next”

Now we have to configure Outcomes. Add Outcome “Send” & Linked to “Send E-mail”. Click “Next”

We have to provide the input properties for the PDF File.

URL String: http://www.dotnetsharepoint.com/Runtime/Runtime/View/PDFView?Paramemployee=#ID (Runtime URL for the view or list whatever we have to show & map with parameter as shown in below figure.)

Smart Object Name: PDFFile

Smart Object Method: Create

Smart Object File Property: PDF

ID Property Name: ID

File Name:  Employee PDF     (Enter File Name what you want)

Page Size:  A4

Page Orientation: Portrait

Click “Next”, we have to map Data Fields ID to ID Property value as shown in below figure. (Create new ID using String data field.)

Click “Finish”. Now drag “Send E-mail” to send outcome.

It will open Wizard, click “Next”

Now map “PDF Smart Object”  to attachments. As shown in Figure below.

It will open PDF wizard, map “To Integer (Value)” from Inline Function to ID. As shown in figure below.

Finally map “Data Field Id” to “To Integer (Value)” as shown in below figure.

Save & Deploy the workflow.

Run the Form and capture the required details then click the save button.
The E-mail is sent to the recipient with the PDF attached.  

Reference: http://help.k2.com/onlinehelp/k2smartforms/userguide/1.0.4/webframe.html#pdf_converter_service_broker.html

Uncheck “Overwrite Existing files” in SharePoint

In SharePoint 2013 we are able to see the option “overwrite Existing files” while attaching documents in Document library. By default the option will be checked most of time by mistakenly end users will upload document with same name so that they can miss the existing document.
To avoid that we will Uncheck that option, so that if they are trying to upload the same name document it will throw error.
We implemented this functionality using JQuery and added in the master page, this will effect only in that particular site only.
Step 1:  Download the master and rename it.
In the new master page we added the JQuery JS file and script as shown below screen shot.
We already uploaded the JS file in the same site in Site Assets library. 

Step 2: Upload the new master page and select the master page for that particular site alone.

Out Put:

Sharepoint On-premises script injection with Powershell

Inject custom JavaScript file to all pages

I want add script into site without editing master page. Using JavaScript Injection we can easily add our custom script into all pages.
Below PowerShell script to inject custom file to all pages.

Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$SiteURL = "http://dotnetsharepoint.com/sites/PublishingSite/"
$actionName = "Lakshmi_JS_INjection"
$actiontype = "ScriptLink"
#Custom Script File
$actionSourceFile ="http://dotnetsharepoint.com/sites/PublishingSite/Documents/Test%20Inject.js"

 $Context =New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$web = $Context.Web




#for all subsites
 foreach($web in $web.Webs)
$actions = $web.get_userCustomActions();

#Delete existing script inject

 foreach($action in $actions)
if($action.get_description() -eq $actionName -and $action.get_location() -eq $actionType){



 $newAction = $actions.add();
$scriptBlock = 'var headID = document.getElementsByTagName("head")[0];var newScript = document.createElement("script");newScript.type ="text/javascript";newScript.src ="';
$scriptBlock += $actionSourceFile + '?ver=' +(Get-Date);
$scriptBlock += '";headID.appendChild(newScript);';
Write-Host "Added"


 Write-Host "error"



how to create PDF Converter Advance Smart Object

PDF Converter

If we want to create PDF file without opening the form or view, we can use this PDF Converter.

Example: Html or URL

Using PDF Converter Smart Object we can create PDF file to send a mail.
For this First we have to create Advance Smart Object using existing PDF Converter Object.

Creating Advance Smart Object

Click on Crete New Smart Object on which list you need. Enter name , select Advance SmartObject  & Allow this to be used in workflow as shown in figure below.

Drag PDF converter to Property     

The PDF Converter has three functions:

  • Create PDF from HTML (raw HTML to PDF Format)
  • Create PDF from URL (Captures a URL to PDF Format)
  • Create PDF from HTML or URL

HTML - Creates a PDF file at a certain point in time
URL - Creates a PDF file upon load of the page
 It will open Add SmartObject window -> Go to Default ServiceObject method binding and Click on Create All

Click on finish , now we can see the Properties and & Method.

Click Finished. Now we created PDF Converter Advance SmartObject.