Skip to content

Instantly share code, notes, and snippets.

View BasantPandey's full-sized avatar
🏠
Working from home

Basant Pandey BasantPandey

🏠
Working from home
View GitHub Profile
@BasantPandey
BasantPandey / package.json
Created May 22, 2016 06:15
Address Book Package.json File
{
"name": "basant",
"version": "1.0.0",
"description": "Basant first project",
"main": "Server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node Server.js"
},
"engines": {
@BasantPandey
BasantPandey / Index.html
Created May 22, 2016 06:48
Address book Startup Page
<!DOCTYPE html>
<html ng-app="myApp">
<head lang="en">
<meta charset="UTF-8">
<title>First App</title>
<script src="\node_modules\angular\angular.min.js"></script>
<script src="index.js"></script>
<link rel="stylesheet" href="\node_modules\bootstrap\dist\css\bootstrap.css"/>
</head>
@BasantPandey
BasantPandey / model.js
Created May 22, 2016 07:33
Create Address book Model
var mongoose = require('mongoose');
module.exports = mongoose.Schema({
firstname: String,
lastname: String,
phone:String,
email:String
});
@BasantPandey
BasantPandey / Server.js
Created May 22, 2016 07:37
Server js with various routs using express & mongoose apply various CRUD operations
/**
* Created by DELL on 4/22/2016.
*/
var express = require('express');
var app = express();
var mongoose = require('mongoose');
var bodyparser = require('body-parser');
var model = require('./model');
var connection = require('./connection');
@BasantPandey
BasantPandey / Server.js
Last active May 22, 2016 07:54
Express Server : Simple express get request to start the server
/**
* Created by DELL on 4/22/2016.
*/
var express = require('express');
var app = express();
app.get('/',function(req,res){
res.send('Hello Express');
});
var Port = process.env.PORT || 3000;
var InitCommon= InitCommon || (function(){
var SearchVerticalClickFix = function SearchVerticalClickFix(){
if (typeof(STSNavigate) != 'undefined') {
STSNavigate = function(a) {
a=GetAbsoluteUrl(a);if(ajaxNavigate.get_search().indexOf("IsDlg=1")!=-1)if(a.indexOf("?")!=-1)if(String(a.match(RegExp("&$")))!="&")a=a+"&IsDlg=1";else a=a+"IsDlg=1";else a=a+"?IsDlg=1";var framed;try{var test = window.frameElement}catch(frameException){framed = true;}; if((!framed && window.frameElement!=null)||typeof SPUpdatePage==="undefined"||typeof SPUpdatePage!=="undefined"&&SPUpdatePage(a))if(isPortalTemplatePage(a))window.top.location.href=STSPageUrlValidation(a);else window.location.href=STSPageUrlValidation(a)
};
}
};
var init= function init(){
@BasantPandey
BasantPandey / SetCutoffMaxBuckets.ps1
Created December 25, 2016 07:15
Powershell to Set SetCutoffMaxBuckets value
function LoadSharePointPowerShellEnvironment
{
write-host "Setting up PowerShell environment for SharePoint..." -foregroundcolor Green
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue
write-host "SharePoint PowerShell Snapin loaded." -foregroundcolor Green
}
@BasantPandey
BasantPandey / BaseCmdlets-Part1.ps1
Created July 14, 2017 19:46
Introduction to PNP Basic Command Part1
Import-Module 'C:\Users\basantp\Documents\PNP Blog Section\Code\SharePointPnPPowerShell2013\SharePointPnP.PowerShell.2013.Commands.dll';
try {
Set-PnPTraceLog -On -LogFile 'C:\Users\basantp\Documents\PNP Blog Section\Code\traceoutput.txt' -Level Error -Delimiter ","
$Url1 = "<SiteURL>"
$Url2 = "<SiteURL>"
Connect-PnPOnline -Url $Url1 -CurrentCredentials -ErrorAction Stop
Write-host "Site $Url1 connected".
$Context1= Get-PnPContext
@BasantPandey
BasantPandey / BaseCmdlets-Part2.ps1
Created July 14, 2017 20:37
The Get-PnPProperty is same as Load method just add the properties to the context
Import-Module 'C:\Users\basantp\Documents\PNP Blog Section\Code\SharePointPnPPowerShell2013\SharePointPnP.PowerShell.2013.Commands.dll';
try {
Set-PnPTraceLog -On -LogFile 'C:\Users\basantp\Documents\PNP Blog Section\Code\traceoutput.txt' -Level Error -Delimiter ","
$Url1 = "<URL>"
Connect-PnPOnline -Url $Url1 -CurrentCredentials -ErrorAction Stop
Write-host "Site $Url1 connected".
$web =Get-PnPWeb
Get-PnPProperty -ClientObject $web -Property Id
"Only print the ID : $($web.Id)"
@BasantPandey
BasantPandey / BrandingConfig_Add.csv
Last active July 17, 2017 20:36
Branding Add Custom Action CSV file
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
URL,Action,Name,Title,Description,Group,LocationRibbon,Location,ButtonID,Alt,Sequence,Command,LabelText,TemplateAlias,Image32by32,Image16by16,CommandAction,EnabledScript,CAML1,CAML2,CAML3,CAML4,CAML5,CAML6,CAML7,CAML8,CAML9,CAML10,CAML11,CAML12,CAML13,CAML14
http://yahoo.com,Add,GetItemsCount,Invoke GetItemsCount Action,Adds custom action to custom list ribbon,SiteActions,CommandUI.Ribbon,Ribbon.List.Share.Controls._children,Ribbon.List.Share.GetItemsCountButton,Get list items count,11,Invoke_GetItemsCountButtonRequest,Get Items Count,o1,_layouts/15/images/placeholder32x32.png,_layouts/15/images/placeholder16x16.png,javascript: alert('Total items in this list: '+ ctx.TotalListItems);,javascript: function checkEnable() { return (true);} checkEnable();,"<CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=""","""><Button Id=""",""" Alt=""",""" Sequence=""",""" Command=""",""" LabelText=""",""" TemplateAlias=""",""" Image32by32=""",""" Image16by16=""",""" /></CommandUIDefinition></CommandUIDef