SharePoint, Office 365, Azure, and Front end JS geek. – Chicago IL
SharePoint, Office 365, Azure, and Front end JS geek. – Chicago IL

PowerShell

PowerShell – Install Module (Verbose Debug)

By setting the system variable $debugPreference = “Continue” we are able to see file level detail when installing PowerShell modules.  This can be helpful to gain an understanding of the dependency and files contained with a module.   Cool trick I didn’t know about until today.

Cheers! 

shades_smile

Code

Screenshots

image

image

image

Reduce SPPKG WebParts Features with Powershell

The below steps will reduce a SPPKG to only select Features and WebParts we want to keep.  Every SPPKG file is actually a ZIP with XML manifest and subfolder for each WebPart and Feature.  Extracting the SPPKG as ZIP allows us to review the internal content, enumerate all Features, and then select ones to keep in a final compressed ZIP file (SPPKG file).

If you want to upload only a few WebParts from a SPPKG package to Office 365’s App Catalog then check out the video below.

Cheers!  

shades_smile

Video

Code

Screenshots

image
image
image

References

VIDEO – Populate Word DOCX with PowerShell

Recently I found a way to dynamically update Microsoft Word text placeholders with PowerShell script.  Because DOCX files are ZIP archive we can extract to a TEMP folder to update the internal XML document text.   From there, bundling to a new ZIP archive and renaming DOCX enable us to deliver the final DOCX version to users.

Below is a demo with full source code.  Cheers! 

shades_smile_thumb

Video

Screenshot

image_thumb[4]

Source Code

PowerShell – Split CSV in 1000 line batches

I recently needed to parse a large CSV text file and break it into smaller batches.  Parsing text with PowerShell can easily be done.  The trick here was to manage two pointers $line (within original large text file) and $i (iterate current up to next break threshold).  The first CSV line with column headers from the original parent text file is preserved in all child CSV files. 

Cheers! 

shades_smile

Source Code

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲