TFS SDK how to download image from TFS Description Field - c#

I developed some integration between Jira and TFS.
Some bugs in TFS have image in Description like this:
<span style="color:black;font-family:"Segoe UI",sans-serif;font-size:9pt;"><img style="width:606px;" src="http://server:8080/tfs/IT_Systems/WorkItemTracking/v1.0/AttachFileHandler.ashx?FileNameGuid=7d796b11-588f-4266-a783-8d3fa61cb4bd&FileName=temp1465385989194.png"><br> </span>
How can I download this image programmatically using c#?
I know I should parse HTML and so on. But problem is I don't know how to extract data from URL.
In TFS web part I select image, copy it, open for example Paint, past image and save it as jpg-file.
I need the same in my c# code.
Can anyone help me?

I would use Regex to parse the HTML description and pull out the img URL then download the image using a HttpWebRequest.
You could use the following Regex:
(?<=<img.*src=")[^"]*

Related

Return image from SQL database using ASP.NET Web API

I'm trying to build Web API that returns images from my SQL database but I'm facing issues with the path of my image that says:
couldn't find a part of the path
Any suggestions would be appreciated.
Check your image folder, did it come with a capital letter? Because your code is displaying Image not image.

Get URL of image in OneDrive

I'm using LiveSDK in C#. Is there any way to get an URL (for example, url like this: https://onedrive.live.com/embed?cid=1ED5694B634A1579&resid=1ED5694B634A1579%21685&authkey=ANQwPScWiCxbILY) for a specified image file in order to put this link directly to the Image (Source property) control?
I dont want to download a Stream from OneDrive file, set it to a BitmapImage and put it to the Image control.
I know that OneDrive web app allows to create an URL for a selected file, but don't know if the SDK has such feature.
There is a very good example in MSDN Samples Page showing how to pull and use images from OneDrive.
Photo Sky SampleThis sample demonstrates how to use the LiveSDK for pulling images from SkyDrive. In this sample you will learn how to use LiveSDK and request consent from the user to access his SkyDrive files and display the images in a Metro style application.
Source: PhotoSky - SkyDrive Sample

How to download images from response of Readability Parser API in C#

I'm using Readability Parser API to get content of the page.
After result received content goes to kidlegen.exe(to generate .mobi) and then to my kindle via email. The problem is content i get from Readability Parser API contains <img> to remote images, so i need to download them firts and only then launch kindlegen.exe.
The question is how to download remote images from article to my disk in efficient way? I can see only one solution - use regexp to parse response to extract <img>, then extract scr attribute and finally download images, but that's definitely worst way.
I'm using ASP.NET MVC.
Looks like i need HtmlAgilityPack. I'll detach this task from web application to console.

How to Add google doc viewer in mvc4 Applicaton?

I am beginner in programming. My problem is, I want to show PDF files in Google Doc Viewer in my website page. I put my PDF files in folder named as Bullettin, it is in App_Data folder.
How can I view this PDF file in my website through Google Doc Viewer using C# MVC4 application?
i used the following code in view page
http://docs.google.com/viewer?url=http://localhost:3907/App_Data/Bullettin/JCI.pdf&embedded=true" target="_blank" class="embed">View
You should use the following url for embed: http://docs.google.com/viewer?url=http://localhost:3907/App_Data/Bullettin/JCI.pdf for previews
and: Preview
for links, and finally:
<iframe src="http://docs.google.com/viewer?url=http://localhost:3907/App_Data/Bullettin/JCI.pdf&embedded=true"></iframe>
For Iframes.
Well, localhost will not work for you, so get your project on a live server or use an IP address to link your server.
Good luck with it.

C# facebook graph / How to upload an image on Facebook album?

I am trying to upload an image using ASP.NET with C#.I do not how to send image in parameter
source="F://sample.jpg".I have also tried to send an image in a byte format.
URL is
http://graph.facebook.com/album_id/photos?access_token=access_tokenvalue;
Post Data is
source= "F://sample.jpg"
I am getting an exception.Please help me to sort out this issue.
Thanks in advance.
Could you post the error message you're getting? Might be helpful in tracking down exactly what the error is. In any case, I'm not too familiar with the Facebook APIs but it appears in the Graph API document for Photo that you have to prefix the file path with an #.
source="#F:\\sample.jpg"

Categories

Resources