Help us understand the problem. What is going on with this article?

ExcelからRedmineのWikiを更新してみた

ExcelからRedmineのWikiを更新してみたので。
今更ですが。

前提条件

  • Redmineに対する知識
  • ExcelおよびVBAに対する知識

コード

これはbase_urlで運用しているRedmineのプロジェクトproject_id下のWikiをAPIアクセスキーacc_keyを使ってTextile形式のテキストwiki_textでガツンと書き換えます。

※APIアクセスキーはRedmineのユーザー設定から取得しておくこと。

Excel表をTextile形式に変換するのは拙稿をご参考に。

'Wiki更新
Sub UpdateWiki(base_url as String, project_id as String, acc_key as String, wiki_text as String)

    Dim uri As String
    uri = base_url & "/projects/" & project_id & "/wiki/Wiki.xml?key=" & acc_key

    Dim http As Object
    Set http = CreateObject("MSXML2.XMLHTTP")

    http.Open "PUT", uri, False

    http.setRequestHeader "Accept", "application/xml"
    http.setRequestHeader "Content-Type", "text/xml"
    http.send CVar("<?xml version=""1.0""?><wiki_page><text>" & wiki_text & "</text></wiki_page>")

    Set http = Nothing

End Sub

Wiki以外を書き換える場合は、uriに指定しているWiki.xmlの部分を変更してください。
部分修正する場合はxmlでGETしてtext要素をパースしてから対応することになります。

参考

あとがき

ログインせずにボタン一発で更新できるってとっても便利。

あと、どなたかユーザー一覧の取得方法をご教示ください。できればVBAで。

GET /users.xml

だと表示数制限にかかってしまって、全員(100名超)は取れないんです。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away