Create a SharePoint App with a Function
A PowerShell with SharePoint tutorial
When
you use PowerShell you can use a script to create multiple
apps of the same kind in very short time and remove apps
just as quickly. In the demo below, Peter Kalmström shows
how to do it with a PowerShell function.
In the
previous article we created simple commands for app
creation and removal. Peter Kalmström uses the "create"
command from that script in the PowerShell function for
SharePoint app creation that he demonstrates in the demo
below.
Peter creates a list app called "Hello World". These are
generic lists with versioning enabled, and they will be
visible on the Quick launch. If you try this script, you
might want to remove the -OnQuickLaunch parameter.
Peter also adds a success message to the function. It is
shown in green in the Command pane for each app that has
been created.
function Create-MyList($ListName, $ListURL){
New-PnPList -Title $ListName -Template GenericList -EnableVersioning -OnQuickLaunch -Url $ListURL
Write-Host ("List " + $ListName + "
has been created!") -ForegroundColor Green
}
Note that only one app is created in this demo. In the
next article,
we
will show how to create a loop that runs through the function
and creates 10 different list apps called "Hello World +
number".
|