Beispiel #1
0
        static void Main( string[] args )
        {
            Uri uri = new Uri( "http://*****:*****@"Z:\kaorun\work\tfs_sandbox\TFS_AdventCalendar\AddAttachments\Program.cs"
                ) );
            newItem.Save();

            // 添付ファイルをダウンロードする
            WebClient request = new WebClient();
            request.Credentials = CredentialCache.DefaultCredentials;

            foreach ( Attachment attachment in newItem.Attachments ) {
                Console.WriteLine( attachment.Name );

                request.DownloadFile( attachment.Uri,
                    Path.Combine( @"C:\Users\kaorun55\Desktop", attachment.Name ) );
            }
        }
Beispiel #2
0
        static void Main( string[] args )
        {
            try {
                Uri uri = new Uri( "http://win7-vm:8080/tfs/" );
                NetworkCredential credential = new NetworkCredential( "hoge", "foo" );
                string collenctionName = "win7-vm\\DefaultCollection";
                string projectName = "TFS_API_SAMPLE";

                TfsClient tfs = new TfsClient( uri, credential,
                                    collenctionName, projectName );
                int id = tfs.AddWorkItem();
                WorkItem item = tfs.GetWorkItem( id );
                Console.WriteLine( item.Title + ":" + item.Description );

                item.Title = "タイトルを変更します";
                item.Description = "詳細は詳しく、細かく書きましょう";
                item.Save();

                WorkItem updateItem = tfs.GetWorkItem( id );
                Console.WriteLine( updateItem.Title + ":" + updateItem.Description );
            }
            catch ( Exception ex ) {
                Console.WriteLine( "Error : " + ex.Message );
            }
        }