magritton
11/15/2015 - 2:53 PM

Adds a new prompted link to a SharePoint list. Also an example of using a function with parameters in powershell.

Adds a new prompted link to a SharePoint list. Also an example of using a function with parameters in powershell.

Add-PsSnapin Microsoft.SharePoint.PowerShell

$SiteUrl = 'http://xxxx'
$topWeb = Get-SPWeb $SiteUrl
$mList=$topWeb.Lists["Linksa"]

function setNewItem($strTitle, $strLink){
$Itemx = $item = $mList.Items.Add()
$Itemx["Title"] = $strTitle
$Itemx["Description"] = "Cell"
$Itemx["LinkLocation"] = $strLink
##$Itemx["BackgroundImageLocation"] =
$Itemx["Order"] = "1"
$Itemx.update()
$mList.update()
}
setNewItem "10 Cell Assembly" "http://xxxxx/"
setNewItem "71SO" "http://xxxxx/"
setNewItem "Assembly" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Assembly/
setNewItem "CNC" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/CNC/"
setNewItem "Engineering" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Engineering/"
setNewItem "Extrusion" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Extrusion/"
setNewItem "Fibrelite" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Fibrelite/"
setNewItem "Janitor Service" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Janitor%20Service/"
setNewItem "Maintenance" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Maintenance/"
setNewItem "Metfab" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Metfab/"
setNewItem "Machine Shop-Welding" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Machine%20Shop-Welding/"
setNewItem "QC" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/QC/"
setNewItem "Roto" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/QC/"
setNewItem "Shipping-Receiving" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Shipping-Receiving/"
setNewItem "Spill Bucket" "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells/Spill%20Bucket/"