Skip to main content
added 6 characters in body
Source Link
Richard Seal
  • 20.8k
  • 5
  • 44
  • 79

I am a sitecore powershellSitecore PowerShell newbie. I

I have to write a sitecore powershellSitecore PowerShell script to ignore certain items from consideration based on their template types. For

For this we can add these items to an array and use -notin-notin for comparison.

Below is a code sample:

#ignored items list start
$nodeFolderTemplate = Get-Item -Path "/sitecore/templates/System/Node" 
$layoutFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Layout Folder" 
$rederingFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Renderings/Rendering Folder"
$commonFolderTemplate = Get-Item -Path "/sitecore/templates/Common/Folder"
$placeHolderSettingsFolder = Get-Item -Path "/sitecore/templates/System/Layout/Placeholder Settings Folder"
$branchFolderTemplate = Get-Item -Path "/sitecore/templates/System/Branches/Branch Folder"
$template = Get-Item -Path "/sitecore/templates/System/Templates/Template"
$dictionaryDomain = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary Domain"
$dictionaryEntry = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary entry"
$ignoredFolders = @( $nodeFolderTemplate.ID, $layoutFolderTemplate.ID, $rederingFolderTemplate.ID, $commonFolderTemplate.ID, $placeHolderSettingsFolder.ID, $branchFolderTemplate.ID )
$ignoredItems = @( $dictionaryDomain.ID, $ignoredFolders.ID, $commonFolderTemplate.ID)
#ignored items list end 

 $items = Get-ChildItem $selectedValues.SelectedFolderPath -Recurse | 
              Where-Object { $_.TemplateID -notin $ignoredFolders }

Can anybody please suggest a better way to do it?

I am a sitecore powershell newbie. I have to write a sitecore powershell script to ignore certain items from consideration based on their template types. For this we can add these items to an array and use -notin for comparison.

Below is a code sample:

#ignored items list start
$nodeFolderTemplate = Get-Item -Path "/sitecore/templates/System/Node" 
$layoutFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Layout Folder" 
$rederingFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Renderings/Rendering Folder"
$commonFolderTemplate = Get-Item -Path "/sitecore/templates/Common/Folder"
$placeHolderSettingsFolder = Get-Item -Path "/sitecore/templates/System/Layout/Placeholder Settings Folder"
$branchFolderTemplate = Get-Item -Path "/sitecore/templates/System/Branches/Branch Folder"
$template = Get-Item -Path "/sitecore/templates/System/Templates/Template"
$dictionaryDomain = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary Domain"
$dictionaryEntry = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary entry"
$ignoredFolders = @( $nodeFolderTemplate.ID, $layoutFolderTemplate.ID, $rederingFolderTemplate.ID, $commonFolderTemplate.ID, $placeHolderSettingsFolder.ID, $branchFolderTemplate.ID )
$ignoredItems = @( $dictionaryDomain.ID, $ignoredFolders.ID, $commonFolderTemplate.ID)
#ignored items list end 

 $items = Get-ChildItem $selectedValues.SelectedFolderPath -Recurse | 
              Where-Object { $_.TemplateID -notin $ignoredFolders }

Can anybody please suggest a better way to do it?

I am a Sitecore PowerShell newbie.

I have to write a Sitecore PowerShell script to ignore certain items from consideration based on their template types.

For this we can add these items to an array and use -notin for comparison.

Below is a code sample:

#ignored items list start
$nodeFolderTemplate = Get-Item -Path "/sitecore/templates/System/Node" 
$layoutFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Layout Folder" 
$rederingFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Renderings/Rendering Folder"
$commonFolderTemplate = Get-Item -Path "/sitecore/templates/Common/Folder"
$placeHolderSettingsFolder = Get-Item -Path "/sitecore/templates/System/Layout/Placeholder Settings Folder"
$branchFolderTemplate = Get-Item -Path "/sitecore/templates/System/Branches/Branch Folder"
$template = Get-Item -Path "/sitecore/templates/System/Templates/Template"
$dictionaryDomain = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary Domain"
$dictionaryEntry = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary entry"
$ignoredFolders = @( $nodeFolderTemplate.ID, $layoutFolderTemplate.ID, $rederingFolderTemplate.ID, $commonFolderTemplate.ID, $placeHolderSettingsFolder.ID, $branchFolderTemplate.ID )
$ignoredItems = @( $dictionaryDomain.ID, $ignoredFolders.ID, $commonFolderTemplate.ID)
#ignored items list end 

 $items = Get-ChildItem $selectedValues.SelectedFolderPath -Recurse | 
              Where-Object { $_.TemplateID -notin $ignoredFolders }

Can anybody please suggest a better way to do it?

added 8 characters in body
Source Link

I am a sitecore powershell newbie. I have to write a sitecore powershell script to ignore certain items from consideration based on their template types. For this we can add these items to an array and use -notin for comparison. 

Below is a code sample - Can anybody please suggest a better way to do it?:

#ignored items list start
$nodeFolderTemplate = Get-Item -Path "/sitecore/templates/System/Node" 
$layoutFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Layout Folder" 
$rederingFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Renderings/Rendering Folder"
$commonFolderTemplate = Get-Item -Path "/sitecore/templates/Common/Folder"
$placeHolderSettingsFolder = Get-Item -Path "/sitecore/templates/System/Layout/Placeholder Settings Folder"
$branchFolderTemplate = Get-Item -Path "/sitecore/templates/System/Branches/Branch Folder"
$template = Get-Item -Path "/sitecore/templates/System/Templates/Template"
$dictionaryDomain = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary Domain"
$dictionaryEntry = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary entry"
$ignoredFolders = @( $nodeFolderTemplate.ID, $layoutFolderTemplate.ID, $rederingFolderTemplate.ID, $commonFolderTemplate.ID, $placeHolderSettingsFolder.ID, $branchFolderTemplate.ID )
$ignoredItems = @( $dictionaryDomain.ID, $ignoredFolders.ID, $commonFolderTemplate.ID)
#ignored items list end 

 $items = Get-ChildItem $selectedValues.SelectedFolderPath -Recurse | 
              Where-Object { $_.TemplateID -notin $ignoredFolders }

Can anybody please suggest a better way to do it?

I am a sitecore powershell newbie. I have to write a sitecore powershell script to ignore certain items from consideration based on their template types. For this we can add these items to an array and use -notin for comparison. Below is a code sample - Can anybody please suggest a better way to do it?

#ignored items list start
$nodeFolderTemplate = Get-Item -Path "/sitecore/templates/System/Node" 
$layoutFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Layout Folder" 
$rederingFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Renderings/Rendering Folder"
$commonFolderTemplate = Get-Item -Path "/sitecore/templates/Common/Folder"
$placeHolderSettingsFolder = Get-Item -Path "/sitecore/templates/System/Layout/Placeholder Settings Folder"
$branchFolderTemplate = Get-Item -Path "/sitecore/templates/System/Branches/Branch Folder"
$template = Get-Item -Path "/sitecore/templates/System/Templates/Template"
$dictionaryDomain = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary Domain"
$dictionaryEntry = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary entry"
$ignoredFolders = @( $nodeFolderTemplate.ID, $layoutFolderTemplate.ID, $rederingFolderTemplate.ID, $commonFolderTemplate.ID, $placeHolderSettingsFolder.ID, $branchFolderTemplate.ID )
$ignoredItems = @( $dictionaryDomain.ID, $ignoredFolders.ID, $commonFolderTemplate.ID)
#ignored items list end 

 $items = Get-ChildItem $selectedValues.SelectedFolderPath -Recurse | 
              Where-Object { $_.TemplateID -notin $ignoredFolders }

I am a sitecore powershell newbie. I have to write a sitecore powershell script to ignore certain items from consideration based on their template types. For this we can add these items to an array and use -notin for comparison. 

Below is a code sample:

#ignored items list start
$nodeFolderTemplate = Get-Item -Path "/sitecore/templates/System/Node" 
$layoutFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Layout Folder" 
$rederingFolderTemplate = Get-Item -Path "/sitecore/templates/System/Layout/Renderings/Rendering Folder"
$commonFolderTemplate = Get-Item -Path "/sitecore/templates/Common/Folder"
$placeHolderSettingsFolder = Get-Item -Path "/sitecore/templates/System/Layout/Placeholder Settings Folder"
$branchFolderTemplate = Get-Item -Path "/sitecore/templates/System/Branches/Branch Folder"
$template = Get-Item -Path "/sitecore/templates/System/Templates/Template"
$dictionaryDomain = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary Domain"
$dictionaryEntry = Get-Item -Path "/sitecore/templates/System/Dictionary/Dictionary entry"
$ignoredFolders = @( $nodeFolderTemplate.ID, $layoutFolderTemplate.ID, $rederingFolderTemplate.ID, $commonFolderTemplate.ID, $placeHolderSettingsFolder.ID, $branchFolderTemplate.ID )
$ignoredItems = @( $dictionaryDomain.ID, $ignoredFolders.ID, $commonFolderTemplate.ID)
#ignored items list end 

 $items = Get-ChildItem $selectedValues.SelectedFolderPath -Recurse | 
              Where-Object { $_.TemplateID -notin $ignoredFolders }

Can anybody please suggest a better way to do it?

edited tags
Link
Mark Cassidy
  • 25.4k
  • 7
  • 59
  • 117
Source Link
NewbieHere
  • 629
  • 4
  • 18
Loading