Skip to content

Instantly share code, notes, and snippets.

@tristian2
Last active December 13, 2024 16:15

Revisions

  1. tristian2 revised this gist Dec 13, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    In confluence watch out for page hierarchy
    #In confluence watch out for page hierarchy

    Import-Module ConfluencePS
    $Username = '************@gmail.com'
    @@ -11,6 +11,6 @@ Get-ConfluenceSpace
    #https://***********.atlassian.net/wiki/spaces/~712020e628e2b3818645efb1b64e5371f102bc/pages/294914/page+1

    Get-ConfluencePage -PageID 294914 | Format-List * #get page info including content
    #get space ley from it's url
    #get space key from its url
    $pages = Get-ConfluencePage -SpaceKey "~712020e628e2b3818645efb1b64e5371f102bc"
    $pages | ForEach-Object { $_.Body } #gets page content as HTML
  2. tristian2 created this gist Dec 11, 2024.
    16 changes: 16 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    In confluence watch out for page hierarchy

    Import-Module ConfluencePS
    $Username = '************@gmail.com'
    #generate a key from here https://id.atlassian.com/manage-profile/security/api-tokens
    $Key = '******************************************' `
    | ConvertTo-SecureString -AsPlainText -Force
    $Credentials = New-Object System.Management.Automation.PsCredential($Username,$Key)
    #Set-ConfluenceInfo -BaseURI 'https://********.atlassian.net/wiki' -Credential $Credentials
    Get-ConfluenceSpace
    #https://***********.atlassian.net/wiki/spaces/~712020e628e2b3818645efb1b64e5371f102bc/pages/294914/page+1

    Get-ConfluencePage -PageID 294914 | Format-List * #get page info including content
    #get space ley from it's url
    $pages = Get-ConfluencePage -SpaceKey "~712020e628e2b3818645efb1b64e5371f102bc"
    $pages | ForEach-Object { $_.Body } #gets page content as HTML