Showing posts from November, 2016

PowerShell script to create Bulk Site Columns in SharePoint

We will be using the CSV source to create multiple or bulk site columns in SharePoint.

1) Create a csv file as source. In the below format

Name,Description,Type,Group,Hidden,ShowInDisplayForm,ShowInEditForm,ShowInNewForm,Termset,Term,Choices,DefaultValue,AllowMultipleValues,Lookup,IsTermGroup Bool Col,,Boolean,MyColGp,FALSE,TRUE,TRUE,TRUE,,,,,,,NO Choice Col,,Choice,MyColGp,FALSE,TRUE,TRUE,TRUE,,,"Chice1,choice2",,,,NO Date Col,,DateTime,MyColGp,FALSE,TRUE,TRUE,TRUE,,,,,,,NO Managed Col,,Managed Metadata,MyColGp,FALSE,TRUE,TRUE,TRUE,TermsetName,Term,,,,,NO Description,,Note,MyColGp,FALSE,TRUE,TRUE,TRUE,,,,,,,NO Text Col,,Text,MyColGp,FALSE,TRUE,TRUE,TRUE,,,,,,,NO Link,,URL,MyColGp,FALSE,TRUE,TRUE,TRUE,,,,,,,NO Col2,,User,MyColGp,FALSE,TRUE,TRUE,TRUE,,,,,,,NO
2) Create a new powershell script with below code

#This script creates site columns from the given csv file#Author: Prem Kumar#Date: Feb 11 2015param( [string]$rooturl = $(Read-Host -prompt "Enter Web Application Ro…

Create List and add content type using SharePoint PnP Framework in SharePoint online

Install the nuget package to visual studio, if it is not installedCreate a sample console application Install the SharePointPnPCoreOnline dll, using the below nuget command.Add Environment variable as MSOPWD for the SP online account password 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17string pwd = System.Environment.GetEnvironmentVariable("EnvironmentVariableName", EnvironmentVariableTarget.User); if(string.IsNullOrEmpty(pwd)) { System.Console.WriteLine("MSOPWD user env variable is empty"); System.Console.ReadKey(); return; } using (var ctx = new ClientContext("https:YourOffice365Site")) { var password = new SecureString(); foreach (char c in pwd.ToCharArray()) password.AppendChar(c); ctx.Credentials = new SharePointOnlineCredentials("YourEmailid", password); …