0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Confluence:Excel VBAからConfluenceの作成済みページにラベルを追加する (Server/DataCenter)

Last updated at Posted at 2021-10-07

手順

1.VBA-JSONの追加

以下を参照ください。

2.参照設定の追加

以下を参照ください。

3.VBAコードの追加

Microsoft Visual Basic for Applications を開き、次のコードを入力し、実行します。

Sub GetPage()
  Dim ohttpReq As New XMLHTTP60
  Dim dJsonParsed As Dictionary
  Dim sUrl As String
  Dim sJson As String
  Dim label As New Dictionary

  ' ラベルを追加する
  label.Add "name", "ラベル"
  sJson = ConvertToJson(label, Whitespace:=2)

  ' エンドポイントのURLを指定する
  sUrl = "https://<ConfluenceのベースURL>/rest/api/content/<ページID>/label"

  ' HTTPリクエストする
  With ohttpReq
    .Open "GET", sUrl
    .setRequestHeader "Authorization", "Basic <Basic認証のユーザー名とパスワード(Base64エンコード)>"
    .setRequestHeader "Content-Type", "application/json; charset=UTF-8"
    .setRequestHeader "X-Atlassian-Token", "no-check"
    .send (sJson)

    Debug.Print .responseText ' HTTPレスポンスをイミディエイトに出力
  End With
End Sub
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?