简体   繁体   中英

What is the difference between team foundation server's “Client” and “WebApi” libraries?

I'm writing C# to interface with TFS to manipulate Work Items in TFS. The existing code I'm working with is exclusively using Microsoft.TeamFoundation.WorkItemTracking.WebApi but from what I see in examples online, the library everyone is using is Microsoft.TeamFoundation.Client and Microsoft.TeamFoundation.WebApi.Client

From what I can infer, the WebApi library is providing only a limited functionality - for instance, I can't create an attachment and associate it to a WorkItem - but, this does appear to be possible with the Client library. Before changing a lot of code to do this, I'm really just interested in knowing what's the underlying difference between these libraries.

Any insight into the TFS client libraries would be much appreciated.

The mainly difference is that Client libraries (SOAP API) use Legacy Client Object Model while WebApi libraries calls the New Rest API to achieve the functions.

And the mainly limitation with these two APIs:

  1. Client libraries cannot work well with the new vNext build system.
  2. WebApi cannot perform update action (For example check in changes) with Version Control, it can only read information for now.

The WebApi can create an attachment and associate it to a Workitem, you need to updolad the attachment to VSTS by call "CreateAttachmentAsync" method and then call "UpdateWorkItemAsync" method to add the uploaded attachment to a work item. It is following a same workflow as the Rest API: Upload an attachment and then Add an attachment .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM