powershell - Sitecore PowerShell:删除项目未删除,如何排除故障?
问题描述
我有简单的 Sitecore8/PowerShell 脚本,我在其中删除图像子项并发布父项:
$child1 = Get-Item $child1Path
Remove-Item $child1 -Force -Permanently
Publish-Item -Item $parent1 -Recurse -PublishMode SingleItem -Language "en*"
运行时没有删除和错误。
我怎样才能找出它为什么不删除?
解决方案
您可以将 Remove-Item 与 -Path 参数一起使用。或使用
$child1 | 除去项目
显然你的脚本不会抛出错误,但删除不是这样工作的。请参阅文档https://doc.sitecorepowershell.com/working-with-items
推荐阅读
- javascript - 根据 vue.js 中的 url 将活动类添加到路由器链接
- python - PyAV:如何同时在屏幕上显示多个视频流
- ios - 如何使用 react-native 在 IOS 中引用当前视图?
- python-3.x - 如何将函数中的代码重复 N 次而不是重新输入?
- java - 代理对象调用抛出参数类型不匹配
- algorithm - 允许重叠的间隔调度算法
- android - 没有库的圆形 UI 设计中的 Android 文本视图
- powershell - Powershell 从 azure devops 构建管道中获取组件治理结果
- google-oauth - 使用 Passport 和 google oauth2 集成登录时如何重定向
- elixir - 使用受监督的过程防止 exunit 测试中的“GenServer terminating”错误