Posts

Showing posts from January, 2018

How to Create SharePoint Sub Site using PowerShell

Image
In this Post we are going to look how to create a SharePoint Sub site using PowerShell. I had to do some research but it was not hard to find a solution. In below Example we will be creating sub site and assigning a Template once it is created. I had a requirement to set a custom Template with basic data, which I have created. It had Many lists and libraries, Nintex Forms, Nintex Workflows Managed Meta Data columns, Content Types etc. Publishing Nintex Forms through PowerShell I will be discussing in my next post Once I created the Sub site, I faced a challenge to set the master page because, newly created site is not getting inherited the master page from the parent. Finally I found the solution from SharePoint Exchange Gentleman called " Evgenii Vilkov " had provided a simple solution to my problem. I have provided a link to same post within comments section in the code snippet. In below Example I have included logging to a CSV file with the use of Add-Content

How to Get SP Item filtered from Power Shell

Image
We are going to look how we can retrieve a SharePoint List item by querying a string column. I should admit I'm really impressed by new Visual Studio Code Power Shell Extension in below snippet I have described how method will be called to get the output. in second Section you will have all details about the Power Shell Method $ spWeb = Get-SPWeb $ spSiteURL ; $ spList = $ spWeb .Lists [ "SPListName" ] ; $ spResultItem = Get-SPItem -ItemValue "SharePoint" -spList $ spList you can see implementation of the Get-SPItem Method in below section function Get-SPItem {   #$ItemValue is the value of the column   #RecordID is the Name of the string column   param ($ ItemValue , $ spList ) ; $ spqQuery = "" ;         try         {             if ($ spList )               {                         $ spqQuery = New-Object Microsoft.SharePoint.SPQuery                 $ spqQuery .Query =