如何与PowerShell找到所有汇合页
我正在尝试在我的实例中拉动所有 Confluence页面,这些页面从1/1/21开始就没有修改。自1/1/21以来,我能够获得所有未经修改的父页面,很容易。但是,我现在试图获取所有 child 页面。
我知道 get-confluencechildPage
具有 -recurse
选项()但是,当我使用它时,我会得到 Invoke-method:目前仅支持Direct Children
。
我创建了一个脚本,该脚本将在顶级页面上迭代并检查是否有子页面。我不知道如何设置DO,直到不复制子页面输出,请参见下图。
这是我到目前为止所拥有的。一旦我可以弄清楚 get-confluencechildpage
弄清楚,我就可以添加一个if并基于日期修改。有人可以将我指向正确的方向吗?请谢谢你。
$Pages = get-confluencespace -spacekey 'SPACEKEY' | get-confluencepage
$NotMod = $pages | ? { $_.version.when -lt (get-date 1/1/21) }
$full = @()
foreach ($1 in $notmod) {
$full += get-confluencepage $1.id
if ($1 | Get-ConfluenceChildPage) {
$Descendents = $1 | Get-ConfluenceChildPage
foreach ($child in $Descendents) {
$full += $child
do {
$Next = 1
$Next = $child | Get-ConfluenceChildPage
if ($next) {
$full += $next
}
} until (
$null -eq $Next
)
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚测试了Atlassian的
confluenceps
模块(v2.5.1)在自托管汇合实例(v7.3.5)上,并且出现get-confluencePage
cmdlet 出现返回给定空间的整个文档树的扁平列表。基于此,您的代码仅仅是:
update
如果出于任何原因,您都不会从
get-confluencePage返回的空间中获得所有页面
,则可以做a depth-first search 在树上使用使用
get get get fee -confluencechildpage
:I've just tested Atlassian's
ConfluencePS
module (v2.5.1) on a self-hosted Confluence instance (v7.3.5), and theGet-ConfluencePage
cmdlet appears to return a flattened list of the entire document tree for a given space.Based on that, your code would simply be:
Update
If, for whatever reason, you don't get all the pages in the Space returned from
Get-ConfluencePage
, you could do a depth-first search of the root pages in the tree usingGet-ConfluenceChildPage
: