Tag: PowerShell Coding

Create a modern team site using PnP PowerShell in SharePoint

Should we create a team site or communication site?

 8,375 total views,  80 views today

 8,375 total views,  80 views today   In this tutorial, we will learn about what is a modern team site in SharePoint, what is a communication site in SharePoint online, what is the difference between team site and communication site in SharePoint Online. Then we will learn about how to create a modern team site in SharePoint

Continue reading

In 2 steps convert a classic SharePoint page to modern using PnP

 8,814 total views,  118 views today

 8,814 total views,  118 views today   Over the many years we as a SharePoint professional, we have been using the SharePoint classic page both in SharePoint on-premise and SharePoint online(classic). But recently in the last couple of years, Microsoft has been focusing to convert the classic SharePoint to modern SharePoint. So in this article, we will

Continue reading

PowerShell: How to pass multiple parameters into a function in PowerShell

 7,955 total views,  144 views today

 7,955 total views,  144 views today   In this post I will show how to pass multiple parameters into a function in PowerShell coding.    Addition of numbers function using PowerShell example: cls #The below sample function will accept numeric parameters and do the addtion. Function Add-Numbers() { param ( [Parameter(Mandatory=$true)] [int32] $FirstNumber, [Parameter(Mandatory=$true)] [int32] $SecondNumber, [Parameter(Mandatory=$false)][int32]

Continue reading

Exception or Error handling in PowerShell -Try/Catch/Finally Block Example

 3,517 total views,  54 views today

 3,517 total views,  54 views today   In this post I will show that how we can handle the exception in PowerShell coding using the try/catch/finally block and how we can write the error or exception message into the log file.   Exception handling using try/catch/finally block PowerShell example: cls $fileName = “File_Uploading_Report” $enddate = (Get-Date).tostring(“yyyyMMddhhmmss”) $logFileName

Continue reading

Using PowerShell create a log file

 2,106 total views,  34 views today

 2,106 total views,  34 views today   In this post, I will show that how to build or create a logging function in PowerShell in the PowerShell “.ps1” file directory. However, we can change to any directory wherever we wish – only we need to change the directory path.   How to create a log file for

Continue reading

Using PowerShell – Create a folder if not exists

 11,577 total views,  244 views today

 11,577 total views,  244 views today   In this post I will show how to create a folder or directory if not exists in the given directory or path using PowerShell code or script.   The below PowerShell code will create a folder with the name “LogFiles” in the .ps1 file root directory if not exists. Create

Continue reading

SharePoint Online Automation – O365 – Upload files to document library using PowerShell CSOM

 13,377 total views,  166 views today

 13,377 total views,  166 views today   Here in this post – I will show how we can upload multiple files or documents to SharePoint online document library using PowerShell CSOM programmatically from the given directory.   Below are the list of files – located in my local directory which I am going to upload to SharePoint

Continue reading

Encode and decode an URL using PowerShell coding

 10,022 total views,  168 views today

 10,022 total views,  168 views today   Here in this post, I will show how to encode and decode the URL using PowerShell coding and also we will learn how to decode a SharePoint list id (GUID) using the online tool. Introduction: A website’s URL, also usually known as the “website address”, is what we would enter

Continue reading

SharePoint Online Automation – O365 – Download files from a document library using PowerShell CSOM

 13,292 total views,  186 views today

 13,292 total views,  186 views today   Here in this post – I will show how we can download files or documents from SharePoint online document library using PowerShell CSOM programmatically from the given date by passing “From Date” and “To Date” to the query. Lets say we want to download certain files from SharePoint document library

Continue reading

SharePoint Online Automation – O365 – Create multiple items in a list using PowerShell CSOM

 2,165 total views,  30 views today

 2,165 total views,  30 views today   Here in this post, I will show how to create multiple list items in SharePoint online list using  PowerShell CSOM code programmatically.   PowerShell CSOM code to add multiple items: CLS #Load SharePoint CSOM Assemblies #Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll” #Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server

Continue reading