【2018.3.6 更新】

最新版本的TFS Java SDK(14.123.1)支持Java SDK 1.6版本,可以从Oracle的官方网站(http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html)下载。


【2017.5.17 更新】

当在Eclipse中使用Java SDK调试代码的时候,你可能会碰到下面的错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.microsoft.tfs.jni.internal.platformmisc.NativePlatformMisc.nativeGetEnvironmentVariable(Ljava/lang/String;)Ljava/lang/String;

你还需要在Java项目的属性设置中指定正确的本地库路径(Native Library Path),如下图:

TFS Java SDK使用指南
    




使用Team Explorer Everywhere (TEE) 2015 SDK获取团队项目的签入策略

--------------

【2015.12.2 更新】

在这里发布了一篇新的文章“


TFS Java SDK使用指南
    




使用Team Explorer Everywhere (TEE) 2015 SDK获取团队项目的签入策略


TFS Java SDK使用指南
    




使用Team Explorer Everywhere (TEE) 2015 SDK获取团队项目的签入策略


在Java项目中创建目录tfssdk,并将SDK中的文件复制到该目录下;将SDK中的文档做成zip文档,并复制到tfssdk目录下(tfs-sdk-11.0-javadoc.zip)

TFS Java SDK使用指南
    




使用Team Explorer Everywhere (TEE) 2015 SDK获取团队项目的签入策略


打开项目属性

TFS Java SDK使用指南
    




使用Team Explorer Everywhere (TEE) 2015 SDK获取团队项目的签入策略


添加JAR,并配置库位置和文档位置

TFS Java SDK使用指南
    




使用Team Explorer Everywhere (TEE) 2015 SDK获取团队项目的签入策略


三、创建并运行样例代码

添加一个样例代码:创建要求工作项

TFS Java SDK使用指南
    




使用Team Explorer Everywhere (TEE) 2015 SDK获取团队项目的签入策略


package com.mycompany.tfsdemo;

import com.microsoft.tfs.core.TFSTeamProjectCollection;
import com.microsoft.tfs.core.clients.workitem.CoreFieldReferenceNames;
import com.microsoft.tfs.core.clients.workitem.WorkItem;
import com.microsoft.tfs.core.clients.workitem.files.Attachment;
import com.microsoft.tfs.core.clients.workitem.files.Attachment;
import com.microsoft.tfs.core.clients.workitem.project.Project;
import com.microsoft.tfs.core.clients.workitem.wittype.WorkItemType;

public class CreateWorkItem
{
    public static void main(final String[] args)
    {
        //Attachment att1;
        //att1 = new Attachment("","");
       
        TFSTeamProjectCollection tpc = SnippetSettings.connectToTFS();

        Project project = tpc.getWorkItemClient().getProjects().get(SnippetSettings.PROJECT_NAME);

        // Find the work item type matching the specified name.
        WorkItemType RequirementWorkItemType = project.getWorkItemTypes().get("要求");

        // Create a new work item of the specified type.
        WorkItem newWorkItem = project.getWorkItemClient().newWorkItem(RequirementWorkItemType);

        // Set the title on the work item.
        newWorkItem.setTitle("Example Work Item");


        // Add a comment as part of the change
        newWorkItem.getFields().getField(CoreFieldReferenceNames.HISTORY).setValue(
            "<p>Created automatically by a sample</p>");

        // Save the new work item to the server.
       
        //TODO: add attachments while creating new work item
        //newWorkItem.getAttachments().add(att1);
       
        newWorkItem.save();

       
       
        System.out.println("Work item " + newWorkItem.getID() + " successfully created");
    }
}

运行代码,成功

TFS Java SDK使用指南
    




使用Team Explorer Everywhere (TEE) 2015 SDK获取团队项目的签入策略

http://www.cnblogs.com/danzhang/  ALM MVP 张洪君

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-10-08
  • 2022-12-23
  • 2021-10-10
  • 2021-11-10
猜你喜欢
  • 2021-10-12
  • 2021-12-02
  • 2021-12-08
  • 2021-12-02
  • 2022-12-23
相关资源
相似解决方案