TFS Extension Data Service C# - c#

Does the TFS Extension Data web service have a similar service in C#? I am trying to get custom TFS extension data through C# instead of REST API.

I assume you want to use C# instead of JavaScript, as REST API (httprequest) can be called in any language.
There are two ways to interact with the data storage service: REST APIs or a Microsoft-provided client service available as part of the VSS SDK. Please check the rest api in the following link, and call this api in your code:
https://learn.microsoft.com/en-us/vsts/extend/develop/data-storage#advanced
The getValue method is a wrapper around the REST APIs, issuing a GET request to the following endpoint:
GET _apis/ExtensionManagement/InstalledExtensions/{publisherName}/{extensionName}/Data/Scopes/User/Me/Collections/%24settings/Documents/myKey

Related

Access to Azure Devops working elements via C#

Is it possible to build a C# application that I can use to access my Azure Devops server and have my work items read out for a particular sprint? If so how, I can't find anything that works. Thanks!
Azure DevOps ships with a standard REST API for most parts and a slightly more archaic SOAP API for most of the rest.
There is documentation available here:
.NET Client Library for REST API
.NET Client library for SOAP API
Pure REST API documentation
For more specific problems, post a new question.
To get work items by iteration, you'd be looking at this API:
Iterations - Get Iteration Work Items
.NET Client Library for REST API: WorkHttpClientBase.GetIterationWorkItemsAsync(TeamContext, Guid, Object, CancellationToken) Method
You can find the nugets here:
.NET Client libraries
A sample using the WorkTrackingClient (not the exact API) is here:
microsoft
/
azure-devops-dotnet-samples

C# program to call existing web API

How can I call / use web API that supports SOAP and REST? I want to write a program in C# that will use this web API. I didn't get much information on the internet. So far, I have created C# project and added the web service reference (WSDL) to my program. Now how can I use the web API. How to send request or receive response? Can you please refer me some good tutorials ?
The HttpClient class is a good starting point. Also there is the EasyHttp library.
Code sample HttpClient: http://code.msdn.microsoft.com/Introduction-to-HttpClient-4a2d9cee
Introduction to EasyHttp: http://devlicio.us/blogs/hadi_hariri/archive/2011/01/16/easyhttp.aspx
Adding web service reference creates client classes that can be used to communicate with web service. All created classes will be in new namespace, You have to look for client proxy class (full name depends on WebService name). Create instance of this class. Calling its methods will call WebService. Here you can read about using Web Services in C#

how to make a service, SOAP web service in .net?

Please forgive me for this basic and a little theoretical question as I dont know much about web services.
I m not refering WCF service, I am reffering simple service in .net / C#. I want to know how to know is it soap or rest service ?
How we can change this type from Soap to Rest and vice versa ?
Thanks
XML Web Services (aka classic/legacy ASMX web services) should not be used for active development. If you must, there is a nice walkthrough on MSDN for adding Web references in more recent versions of Visual Studio (> 2005).
On the other hand, if your web service is truly Restful then you won't be able to create the equivalent of a service reference to it. You'll need to either use the HttpWebRequest, WebClient, or the new HttpClient from .NET 4.5 (also available from the Rest starter kit which is depreciated as well).
As an alternative if you are looking to implement a client that is able to handle both situations, I would recommend HttpWebRequest to POST to the SOAP (non-WCF) service. The problem with this method is you'll likely have to wrap the request in the SOAP wrapper yourself. Luckily there are examples of doing so on the net that you can at least use as a starting point.
ASMX services are build upon SOAP. REST is simply a HTTP based, You can access(or call) your business resources the way you access the normal URLs.
For ex in products catalog system, by using asmx you create set of functions to add,update,delete products. like addProduct(),updateProduct, etc..
But in REST, you will be having single point of access, like http:\mysystem\prodcuts. To retrieve,add,update,delete products, you will be using respective HTTP verbs (GET,POST,PUT,DELETE) on the same URL.
so,technically it's not possible to convert asmx(SOAP) service to rest...

Calling basic authentication java webservice with C# Client

I have a c# client application calling java web services. Everything works great but now i need to send some authentication data since we are trying to restrict who calls the web service. The java web service expects basic authentication.
How do i go about providing this in my c# client? I am not using WCF or WSE, just plain webservice (using Add Web Reference).
Here's a link for the solution i found in case some one needs it. I was able to fix my issue by modifying some of the stuff in the suggested article.
http://www.c-sharpcorner.com/UploadFile/pchandraker/1052/

To consume a RESTful web service in C#, should I use HttpWebRequest?

How do I consume a RESTful web service in C# code?
NOTE: by RESTful, I mean non-SOAP. For example, in the flickr API you can call their web service as follows to return JSON data:
http://api.flickr.com/services/feeds/photos_public.gne?tags=cats&tagmode=any&format=json
Do I simply use HttpWebRequest?
What if I'm using a web service that takes POST parameters? Would that use HttpWebRequest also?
Is there any benefit to using WCF on the consumer side?
WCF provides a unified programming model for communication, so if you later decide that you do not want to use REST or you want to provide an extra type of endpoint for example SOAP, you only need tp change the configuration.
Take a look at REST for WCF:
http://msdn.microsoft.com/en-us/netframework/cc950529.aspx
Their is a demonstration and labs in the .NET Framework 3.5 Enhancements Training Kit, which provides two labs based around creating, servicing and consuming RESTFul services. The above link is the best MS combined resources of REST services.
Bob.

Categories