-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download attachment from Jira task to local filesystem #318
Comments
Hi, I would like to support this feature.
I have been playing around with it and so far been unsuccessful. |
This can be done with current resources: Invoke-JiraMethod -Uri (Get-JiraIssueAttachment -Issue TV-14).Content[0] -OutFile foo.txt
dir foo.txt
but... ConfluencePS has a dedicated command for this: If you want to contribute, you can submit a PR implementing this for JiraPS :-) |
I must be doing something incorrectly in my script, hoping you can help. I am looping through all $JiraObjects I find in a specific filter, and then trying to find all ".PNG" attachments for a given issue and download them to my desktop to then use later on. It seems nothing is found when I use the following code, I amended it to include what you suggested.
|
Yeah... that function needs some work... not the most user friendly. Get-JiraIssue "TV-13", "TV-14" | Get-JiraIssueAttachment -ea 0 | % { Invoke-JiraMethod -Uri $_.content -OutFile $
_.filename } |
Hi, could you advise on why it is not so user friendly? I would be glad to take your advice on board. I have tried your suggestion and I did not have any success. I removed the "ea" switch so I could see the errors. I need only .PNG attachments, so I added a filter for only these types of attachments. I also had to add the $Credentials to stop it from throwing the permission error. I end up with this line: One thing is, I am not sure where these images would be saved on my machine by just supplying $_.filename? My aim with this script is to aid our developers, so we don't have to manually create Release Notes. This is the error I got when running the script:
Edit - I have resolved this, the Invoke-JiraMethod needed my credentials passing too. |
hey @nickrobbo
sure. here a the ones I can identify without investigating too much:
In the current directory (
This looks strange. can you run the command with |
I added -Credentials $Credential to the Invoke-JiraMethod command, and this resolved that error. Thanks for your input, I will go back and refactor the script.
This is still a rough work in progress, so there are parts hard-coded which will not be in the end. |
Great to hear you could make it work. I only have two comments about your script. specifically this line:
|
Hi, yes I am in the process of adding the parts which will use the attachments, and then delete them once they have been added to the document. Sorry, I should have mentioned that. In relation to point 1, when I used |
great. |
Thanks, you can now close this issue if you want. |
Context
Description
Additional Information
The text was updated successfully, but these errors were encountered: