Skip to content

Instantly share code, notes, and snippets.

@TiloGit
Last active October 8, 2025 06:18
Show Gist options
  • Select an option

  • Save TiloGit/f360d0ff2f21b08789064c4528e07b99 to your computer and use it in GitHub Desktop.

Select an option

Save TiloGit/f360d0ff2f21b08789064c4528e07b99 to your computer and use it in GitHub Desktop.

Revisions

  1. TiloGit revised this gist Oct 8, 2025. 1 changed file with 10 additions and 9 deletions.
    19 changes: 10 additions & 9 deletions cmis_create_folder_file.ps1
    Original file line number Diff line number Diff line change
    @@ -11,10 +11,20 @@ $basicAuthValue = "Basic $encodedCreds"
    $Headers = @{
    Authorization = $basicAuthValue
    }

    # Define form data as a hashtable
    $formData = @{
    "cmisaction" = "createFolder"
    "succinct" = "true"
    "propertyId[0]" = "cmis:objectTypeId"
    "propertyValue[0]" = "cmis:folder"
    "propertyId[1]" = "cmis:name"
    "propertyValue[1]" = $folderName
    }

    # Send POST request
    Invoke-WebRequest -Uri $url -Method Post -Body $formData -Headers $Headers

    ##############
    ### create file in CMIS
    ##############
    @@ -66,12 +76,3 @@ Invoke-RestMethod -Uri $url `
    -Headers @{ Authorization = $basicAuthValue; "Content-Type" = "multipart/form-data; boundary=$boundary" } `
    -Body $payload


    "propertyId[0]" = "cmis:objectTypeId"
    "propertyValue[0]" = "cmis:folder"
    "propertyId[1]" = "cmis:name"
    "propertyValue[1]" = $folderName
    }

    # Send POST request
    Invoke-WebRequest -Uri $url -Method Post -Body $formData -Headers $Headers
  2. TiloGit revised this gist Oct 8, 2025. 2 changed files with 77 additions and 25 deletions.
    25 changes: 0 additions & 25 deletions cmis_create_folder.ps1
    Original file line number Diff line number Diff line change
    @@ -1,25 +0,0 @@
    # Generate timestamp
    $myDate = get-date -uformat "%Y-%m-%d_%s"
    $folderName = "tilo_folder_$myDate"

    # Define URL and credentials
    $url = "http://99.99.97.146:8077/cmis/browser/Y8/root"
    $pair = "admin:mypass"
    $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
    $basicAuthValue = "Basic $encodedCreds"
    $Headers = @{
    Authorization = $basicAuthValue
    }

    # Define form data as a hashtable
    $formData = @{
    "cmisaction" = "createFolder"
    "succinct" = "true"
    "propertyId[0]" = "cmis:objectTypeId"
    "propertyValue[0]" = "cmis:folder"
    "propertyId[1]" = "cmis:name"
    "propertyValue[1]" = $folderName
    }

    # Send POST request
    Invoke-WebRequest -Uri $url -Method Post -Body $formData -Headers $Headers
    77 changes: 77 additions & 0 deletions cmis_create_folder_file.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,77 @@
    #### create Folder
    # Generate timestamp
    $myDate = get-date -uformat "%Y-%m-%d_%s"
    $folderName = "tilo_folder_$myDate"

    # Define URL and credentials
    $url = "http://99.99.97.146:8077/cmis/browser/Y8/root"
    $pair = "admin:mypass"
    $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
    $basicAuthValue = "Basic $encodedCreds"
    $Headers = @{
    Authorization = $basicAuthValue
    }
    # Define form data as a hashtable
    $formData = @{
    "cmisaction" = "createFolder"
    "succinct" = "true"
    ##############
    ### create file in CMIS
    ##############
    # Generate timestamp
    $myDate = Get-Date -UFormat "%Y-%m-%d_%s"

    # Define URL and credentials
    $url = "http://99.99.97.146:8077/cmis/browser/Y8/root"
    $pair = "admin:mypass123"
    $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
    $basicAuthValue = "Basic $encodedCreds"

    $boundary = "$([System.Guid]::NewGuid().ToString('N'))"

    ##generate payload
    $payload = @"
    --$boundary
    Content-Disposition: form-data; name="cmisaction"
    createDocument
    --$boundary
    Content-Disposition: form-data; name="propertyId[0]"
    cmis:name
    --$boundary
    Content-Disposition: form-data; name="propertyValue[0]"
    test_$myDate.txt
    --$boundary
    Content-Disposition: form-data; name="propertyId[1]"
    cmis:objectTypeId
    --$boundary
    Content-Disposition: form-data; name="propertyValue[1]"
    cmis:document
    --$boundary
    Content-Disposition: form-data; name="media"; filename="test_$myDate.txt"
    Content-Type: text/plain
    test tilo here at $myDate
    --$boundary--
    "@
    $payload = $payload -replace "`n","`r`n"

    Invoke-RestMethod -Uri $url `
    -Method Post `
    -Headers @{ Authorization = $basicAuthValue; "Content-Type" = "multipart/form-data; boundary=$boundary" } `
    -Body $payload


    "propertyId[0]" = "cmis:objectTypeId"
    "propertyValue[0]" = "cmis:folder"
    "propertyId[1]" = "cmis:name"
    "propertyValue[1]" = $folderName
    }

    # Send POST request
    Invoke-WebRequest -Uri $url -Method Post -Body $formData -Headers $Headers
  3. TiloGit revised this gist Oct 2, 2025. 2 changed files with 23 additions and 8 deletions.
    8 changes: 0 additions & 8 deletions cmis_create_folder.sh
    Original file line number Diff line number Diff line change
    @@ -1,8 +0,0 @@
    myDate=$(date +"%Fat%s")
    curl -u admin:mypass -X POST http://99.99.97.146:8077/cmis/browser/Y8/root -d \
    "cmisaction=createFolder" -d \
    "succinct=true" -d \
    "propertyId[0]=cmis:objectTypeId" -d \
    "propertyValue[0]=cmis:folder" -d \
    "propertyId[1]=cmis:name" -d \
    "propertyValue[1]=tilotestfolder_$myDate"
    23 changes: 23 additions & 0 deletions cmis_create_folder_file.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    ##create folder below
    myDate=$(date +"%Fat%s")
    curl -u admin:mypass -X POST http://99.99.97.146:8077/cmis/browser/Y8/root -d \
    "cmisaction=createFolder" -d \
    "succinct=true" -d \
    "propertyId[0]=cmis:objectTypeId" -d \
    "propertyValue[0]=cmis:folder" -d \
    "propertyId[1]=cmis:name" -d \
    "propertyValue[1]=tilotestfolder_$myDate"

    ##create file below
    myDate=$(date +"%Fat%s")
    echo "test tilo here at $myDate" > test-tilo.txt
    curl -u admin:mypass \
    -X POST \
    -H "Content-Type: multipart/form-data" \
    -F "cmisaction=createDocument" \
    -F "propertyId[0]=cmis:name" \
    -F "propertyValue[0]=test_$myDate.txt" \
    -F "propertyId[1]=cmis:objectTypeId" \
    -F "propertyValue[1]=cmis:document" \
    -F "[email protected]" \
    http://99.99.97.146:8077/cmis/browser/Y8/root
  4. TiloGit revised this gist Sep 26, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cmis_create_folder.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    myDate=$(date +"%Fat%s")
    curl -u admin:mypass -X POST -u admin:mypass http://99.99.97.146:8077/cmis/browser/Y8/root -d \
    curl -u admin:mypass -X POST http://99.99.97.146:8077/cmis/browser/Y8/root -d \
    "cmisaction=createFolder" -d \
    "succinct=true" -d \
    "propertyId[0]=cmis:objectTypeId" -d \
  5. TiloGit revised this gist Sep 25, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cmis_create_folder.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    myDate=$(date +"%Fat%s")
    curl -u admin:mypass -X POST -u admin:admin http://99.99.97.146:8077/cmis/browser/Y8/root -d \
    curl -u admin:mypass -X POST -u admin:mypass http://99.99.97.146:8077/cmis/browser/Y8/root -d \
    "cmisaction=createFolder" -d \
    "succinct=true" -d \
    "propertyId[0]=cmis:objectTypeId" -d \
  6. TiloGit created this gist Sep 25, 2025.
    25 changes: 25 additions & 0 deletions cmis_create_folder.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    # Generate timestamp
    $myDate = get-date -uformat "%Y-%m-%d_%s"
    $folderName = "tilo_folder_$myDate"

    # Define URL and credentials
    $url = "http://99.99.97.146:8077/cmis/browser/Y8/root"
    $pair = "admin:mypass"
    $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
    $basicAuthValue = "Basic $encodedCreds"
    $Headers = @{
    Authorization = $basicAuthValue
    }

    # Define form data as a hashtable
    $formData = @{
    "cmisaction" = "createFolder"
    "succinct" = "true"
    "propertyId[0]" = "cmis:objectTypeId"
    "propertyValue[0]" = "cmis:folder"
    "propertyId[1]" = "cmis:name"
    "propertyValue[1]" = $folderName
    }

    # Send POST request
    Invoke-WebRequest -Uri $url -Method Post -Body $formData -Headers $Headers
    8 changes: 8 additions & 0 deletions cmis_create_folder.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    myDate=$(date +"%Fat%s")
    curl -u admin:mypass -X POST -u admin:admin http://99.99.97.146:8077/cmis/browser/Y8/root -d \
    "cmisaction=createFolder" -d \
    "succinct=true" -d \
    "propertyId[0]=cmis:objectTypeId" -d \
    "propertyValue[0]=cmis:folder" -d \
    "propertyId[1]=cmis:name" -d \
    "propertyValue[1]=tilotestfolder_$myDate"