微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用powershell融合创建页面

如何解决使用powershell融合创建页面

当我使用以下Powershell代码创建融合分页时,它适用于较小的HTML代码,但将Word文档转换为HTML会引发错误

enter image description here

这是Powershell代码

$ConfluenceURL = "https://wiki-test.company.com/confluence/rest/api/content"
$cred = Get-Credential
$BODYVALUE=Get-Content 'C:\Users\test.html'



 $Headers = @{'Authorization' = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(($cred.UserName+":"+[System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::securestringToBSTR($cred.Password)) )))
'X-Atlassian-Token' = 'nocheck'
}
$pageTitle = "convert1"
$space = "DEMO"
$body =
"{
`"type`":`"page`",`"title`":`"$pageTitle`",`"space`": {`"key`":`"$space`"},`"body`":{
`"storage`":{
`"representation`":`"storage`",`"value`":`"<p>$BODYVALUE</p>`"
}
}
}"
Invoke-WebRequest -Method POST -Headers $Headers -Uri $ConfluenceURL -Body $body -ContentType "application/json" | ConvertFrom-Json

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。