Create SharePoint Apps with Function and For-Loop
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 create multiple apps in just
one script run, using a PowerShell function combined with
a so called "for-loop".
In the
previous article we created a function for app creation.
The for loop calls this function several times, and Peter
sets the parameters that give different app names and tells
the for-loop when to stop looping through the function.
Peter continues to use the list app name "Hello World",
and an integer variable makes sure that a specific number
is added to each name.
for($i=1;$i -lt 11;$i++){
Create-MyList -ListName ("Hello
World" + $i) -ListURL ("HelloWorld" + $i)
}
Peter also creates a for-loop that removes all the apps.
for($i=1;$i -lt 11;$i++){
Remove-PnPList ("Hello
World" + $i) -Force
}
|