Posts

Showing posts from January, 2018

Extract Documents to Folder based on Managed Metadata Column - SharePoint

Image
  How to Extract documents from Multiple Document libraries in to Folders. Each has a Managed Metadata Column with Sub Terms. I have created three Functions to  Download Document Create Folder Main Method Addition to above, script will log the Document URL and destination Folder Path in .log file Create Folder   Function   Create-Folder {      param  ( $folderPath )      if  (!( Test-Path  -path  $folderPath ))     {          New-Item   $folderPath  -type directory     } } Download Document ( this is stolen from Stackoverflow 😁 ) Function   Download-Document {      param ( $web ,  $folderPath ,  $docItem )       #File Download Snippet Reffered From : https://stackoverflow.com/questions/43350575/how-to-use-powershell-to-download-files-from-sharepoint        $File  =  $web .GetFile ( $docItem .Url )          $Binary  =  $File .OpenBinary ()          $detinationPath  =  $folderPath  +  "\"  +  $File .Name ;          $Stream  =  New-Object  System.IO.FileStream( $detinationPath

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 =                  

Pre-Upgrade Check List

Download Our Free SharePoint Pre-Upgrade Check List

* indicates required

Vintage Clan