The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Downloading Attachments from JIRA API using VBA

Joe Buttigieg
November 20, 2016

Hi,

We have a number of calls written in Excel/VBA that we use to pull data from JIRA using its APIs. One of those calls is to download attachments from a JIRA issue. Up until last week, everything was working fine and Atlassian are indicating they made a slight change to the storage of attachments which has coincided with the problem being seen. 

I can successfully download attachments from prior to last week. Attachments from last week to now, are returning a run-time error in the VBA code when doing the send. 

The code I have is:

With JiraService
.Open "GET", https://JIRACloudsite/secure/attachment/AttachmentID/FileName.pdf, False
.SetRequestHeader "Content-Type", "application/json"
.SetRequestHeader "Authorization", "Basic " & sEncbase64Auth
.SetRequestHeader "Accept", "application/json"
.Send

When doing the send, I am getting a "Run-time error -2147024891 (80070005) Access is denied". 

Has anyone else encountered this problem and any ideas of a solution?

 

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
MR2001
Contributor
November 24, 2016

Please try the following:

  1. Declare JiraService as:
    Dim JiraService As MSXML2.ServerXMLHTTP60 
    rather than:
    Dim JiraService As MSXML2.XMLHTTP60

      2. Add the following lines of code to above procedure:

            With JiraService

            .setRequestHeader "Origin", "your JIRA URL"

            .setRequestHeader "X-Atlassian-Token", "nocheck"

(JIRA URL can be something like: "https://abcedJira.com:8443/")

 

0 votes
MR2001
Contributor
November 24, 2016

Great, happy it solved the problem!

Jyothi_Kondapalli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 21, 2020

Hi , 

 

I very new to vba and looking for code to read and download attachments from a jira issue. can you please share code. Appreciate your help

0 votes
Joe Buttigieg
November 24, 2016

That did the trick. I cannot thank you enough.

Jyothi_Kondapalli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 21, 2020

Hi Joe, 

 

I very new to vba and looking for code to read and download attachments from a jira issue. can you please share code. Appreciate your help.