Top Menu

Thursday, October 2, 2014

Real Quick JSON Example

JSON is better to handle than XML. Was using it in a project so thought to post here,
<div id="dvResult">Loading...</div>

<script>
var data = [
    {"firstName":"Michael","lastName":"Jackson","SSN":"123456789"}, 
    {"firstName":"Barack","Obama":"Smith","SSN":"124456789"},
    {"firstName":"Peter","lastName":"Jackson","SSN":"125456789"}
];

var x = '';

for (i = 0; i < data.length; i++)
{
    x = x + data[i].firstName + " " + data[i].lastName + " " + data[i].SSN + "<br/>";
}

document.getElementById("dvResult").innerHTML = x;

</script>

Bulk Site Collection Deletion using PowerShell

Description:
Following powershell reads the list of site collections from the file and deleted them:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

function WriteLog
{
    Param([string]$message, [string]$logFilePath)
    Add-Content -Path $logFilePath -Value $message
}

$LogFile = "G:\DeletedSites.log"
$ListFile = "G:\List.csv"

$Sites = Import-CSV $ListFile

ForEach ($S in $Sites) 
{
    
    try
    {  

        $URL = $S.URL

        $Now = [System.DateTime]::Now
        $MSG = $Now.ToString() +  " | Deleting site: " + $URL
        write-host $MSG
        WriteLog $MSG $LogFile
        
        Remove-SPSite -Identity $URL -GradualDelete -Confirm:$false


    }
    catch [system.exception]
    {
        $Now = [System.DateTime]::Now
        $MSG = $Now.ToString() + "Exp: " + $_.Exception.Message
        write-host -f red $MSG
        WriteLog $MSG $LogFile
    }

    $Site = $Null
}

write-host "Done."

Wednesday, October 1, 2014

Get Claims Programmatically

And that's how you get all the claims for a user programmatically in .NET. Almost similar to my older post:
public void GetClaims()
{

    System.Security.Principal.IPrincipal ipl = System.Web.HttpContext.Current.User;
    System.Security.Claims.ClaimsIdentity claimsIdentity = (System.Security.Claims.ClaimsIdentity)ipl.Identity;
    foreach (System.Security.Claims.Claim oClaim in claimsIdentity.Claims)
    {
        Response.Write("ClaimType [" + oClaim.Type.ToLower() + "] has value [" + oClaim.Value + "]");
    }

}

Get Query String from JavaScript

I use this javascript function in every other project and every time I have to go to the internet and search for it. I am just too lazy to look and copy it from the old projects. So I am copying it from the internet to save it in my personal source code repository.
function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

var strValue = getParameterByName('Value');

document.write(strValue);

Monday, September 22, 2014

Sharepoint 2013 Training

I am providing following training to people who want to learn SharePoint Development.
Please comment on this post for your questions.

Module I - Introduction to SharePoint (8 hr)
  1. What is a CMS?
  2. Microsoft Echo System
  3. SharePoint Job Roles
  4. SharePoint Architecture
  5. 3 Tier Architecture
  6. Central Admin - Walkthroughof CA
  7. SharePoint Site - Creating a Site Collection
  8. List and Libraries - Creating a List
  9. List and Libraries - Calendar, Tasks, Announcements, Document Lib, Images Lib
  10. Columns - Text Col, Date Col, Choice Col, Calculated Col, Lookup Col
  11. Views - Creating a View (Grouping, Filter, Sorting etc)
Module II - SharePoint Content Management (8 hr)
  1. Site Collection & Subsite - Difference between Site Collection & Sub Site.
  2. Site Settings - Change Site Name, Logo etc
  3. Navigation - Updating the Left Navigation
  4. Security - Site Owner (Owner), Member(Contributor), Visitor(Reader)
  5. Document Library - Creating a Document Library, Checking In/Out, Versioning.
  6. Content Type - Using Content Type in a Doc Lib.
  7. Editing Pages - Adding text to pages.
Module III - Site Customization (2 hr)
  1. Adding Pages - Creating a New Page
  2. Web Part - What is a Web Part? 
  3. Adding Web Parts Adding - OOB web parts (Content Editor Web Part, Image Viewer Web Part, Youtube Video embedding).
  4. Advance Web Parts - List View Web Part etc
  5. Layout - Modifying the Page Layout
Module IV - Workflow Development (6 hr)
  1. Business Process - What is a Business Process?
  2. Workflow - What is a Workflow?
  3. Design - Design a workflow in Visio.
  4. Workflow Parts - Condition, Action and Properties.
  5. Develop - Develop a workflow using SharePoint Designer.
Module V - Site Branding with SharePoint Designer (8 hr)
  1. HTML - Introto HTML5
  2. Customizing Pages - Creating New Pages
  3. WebPart - Customization Customizing the DataView Web Part
  4. Master Page - What is a Master Page? Difference between ASPX and Master Page
  5. Branding - Customizing the Master Page
Module VI - Web Part Development (8 hr)
  1. SDLC - Software Development Life Cycle
  2. C# - Intro to C#, Making the UI, Writing the code.
  3. ASP.NET - Intro to ASP.NET, Making the UI, Writing the code.
  4. Visual Web Part Development - Hello World Web Part, Web Part Life Cycle
Module VII - Web Part Development (8 hr)
  1. CAML - Query SharePoint Data
  2. Advance Web Part - Accessing data through Web Part
  3. Feature - Deployment of Web Part through features
  4. Scope - Farm, Site, Web, Web Application
Module VIII - Business Intelligence (8 hrs)
  1. Reporting - What is a Report?
  2. Excel - Introduction to Excel
  3. Excel Services - Excel Web Access web part
  4. Publishing - Publishing an Excel to SharePoint.
Module IX - Business Intelligence (8 hrs)
  1. Excel Services - PowerPivot
  2. Excel Services - PowerView
  3. Dashboard - Lets build a Dynamic Dashboard.
Module X - App Development using Visual Studio (8 hr) - Optional
  1. Java Script - Intro to JavaScript
  2. App - What is an App?
  3. SDLC - Software Development Life Cycle
  4. App LifeCycle - Client Side Object Model
  5. Development - Developing an App using Visual Studio
  6. Deployment - Deploying an App
Module XI - App Development (8 hr) - Optional
  1. JSOM - JavaScript Object Model
  2. Advance App - Data driven app development
  3. App Security - App Scope and Permissions


Friday, September 19, 2014

Playing Video in SharePoint

In my recent project I have used JWPlayer to play videos in a SharePoint portal and it works great.
Here is the demo:

Loading the player...

Thursday, September 18, 2014

HarvardX Interactive Learning Challenge - Binomial Distribution

Input


Official SharePoint Documentation

I have recently contributed to the official SharePoint documentation for developement. Check it out here: https://docs.microsoft.com/en-us...