Hi,
I have 15 subsites and one list,I want this list in 15 subsites. Can you give me the procedure.
(Visited 27 times, 1 visits today)
Use powershell cmdlet
Here is a snippet:
Add-PSSnapin
Microsoft.SharePoint.PowerShell
-ErrorAction
SilentlyContinue
#Function to copy List or Library from One SharePoint site to another
Function CopyList[string]
$SourceWebURL
, [string]
$TargetWebURL
, [string]
$ListName
, [string]
$BackupPath
)
{
#Get the Source List
$SourceList
=(Get
-SPWeb
$SourceWebURL
).Lists[
$ListName
]
#Export the List from Source web
Export
-SPweb
$SourceWebURL
-ItemUrl
$SourceList
.DefaultViewUrl
-IncludeUserSecurity
-IncludeVersions
All
-path
(
$BackupPath
+
$ListName
+
".cmp"
)
-nologfile
-Force
#Import the List to Target Web
import
-spweb
$TargetWebURL
-IncludeUserSecurity
-path
(
$BackupPath
+
$ListName
+
".cmp"
)
-nologfile
-UpdateVersions
Overwrite
}
#Get All List Names
$Lists
= @($(Get
-SPWeb
$SourceWebURL
).lists)
foreach
(
$List
in
$Lists
)
{
#Leave the Hidden Lists and exclude certain Libraries
if(
$List
.Hidden
-eq
$false
-and
$List
.Title
-ne
"Style Library"
-and
$List
.Title
-ne
"Site Pages"
)
{
#Call the function to copy
}
}
Write-Host
"Completed Copying Lists!"
Hope this will help you.
(Visited 1 times, 1 visits today)