问题描述
当我使用以下Powershell代码创建融合分页时,它适用于较小的HTML代码,但将Word文档转换为HTML会引发错误。
这是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 (将#修改为@)