Last active
June 2, 2016 16:04
-
-
Save kilasuit/cec0f65f852ba9b9c4fb12d66a143a65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Initialize-SPPS -siteURL https://tenant.sharepoint.com/ -UserCredential $MYO365cred -IsOnline 1 -Verbose | |
Get-List "TestList" # Creates list variable | |
Get-ListFields -ListTitle $list.Title # Creates listfields variable | |
Get-Listviews -ListTitle $list.Title # Creates listviewIDs variable | |
$fieldstocopy = $listfields | Where-Object { $_.FromBaseType -notlike "True" } | |
$viewstocopy = New-Object System.Collections.Arraylist | |
$ListViewIDs | foreach { Get-Listview -ListTitle $list.Title -ListViewName $_.Title ; $viewstocopy.Add($ListView) } | |
Initialize-SPPS -siteURL https://tenant.sharepoint.com/sites/testsite -UserCredential $MYO365cred -IsOnline 1 -Verbose | |
Add-List -listTitle 'TestCopy' -templateType GenericList -Description ESTest -Verbose | |
Get-List "TestCopy" | |
foreach ($fieldtocopy in $fieldstocopy) | |
{ | |
Add-Field -listTitle $list.Title -fieldName $fieldtocopy.Title -fieldXML $fieldtocopy.SchemaXML | |
} | |
foreach ($viewtocopy in $viewstocopy) | |
{ | |
New-ListView -ListTitle $list.Title -ViewTitle $viewtocopy.Title -ViewRowLimit $viewtocopy.RowLimit -ViewQuery $viewtocopy.ViewQuery -ViewFields $viewtocopy.ViewFields | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment