태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

'2015/03'에 해당되는 글 2건

  1. 2015.03.23 Team Foundation Server Client API
  2. 2015.03.16 SSRS Report Deploy RSS example
분류없음2015.03.23 17:38

using Microsoft.TeamFoundation.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Framework.Common;

namespace ClassLibrary1
{
    public class Class1
    {
        public static TfsTeamProjectCollection GetTeamProjectCollection(string collectionName)
        {
            TfsTeamProjectCollection projectCollection = null;

            var networkCredencial = new NetworkCredential
            {
                UserName = @"domain/username",
                Password = "password"
            };

            var uri = "http://mytfs.company.com:8080/tfs/" + collectionName;
            projectCollection = new TfsTeamProjectCollection(new Uri(uri), networkCredencial);

            return projectCollection;
        }

        public static int GetProjectsCount(string collectionName)
        {
            int projects = 0;

            var teamProjectCollection = GetTeamProjectCollection(collectionName);

            if (teamProjectCollection != null)
            {
                teamProjectCollection.EnsureAuthenticated();

                ReadOnlyCollection<CatalogNode> projectNodes = teamProjectCollection.CatalogNode.QueryChildren(
                    new[] { CatalogResourceTypes.TeamProject },
                    false, CatalogQueryOptions.None);

                projects = projectNodes.Count();
            }
            else
            {
                throw new InvalidOperationException("Invalid TeamProject Collection");
            }

            return projects;
        }
    }
}

 

신고
Posted by webmars
TFS Tips2015.03.16 16:23

DIM definition As [Byte]() = Nothing
DIM warnings As Warning() = Nothing

Public Sub Main()
 Try
  DIM stream As FileStream = File.OpenRead(FILEPATH + REPORTNAME + ".rdl")
  definition = New [Byte](stream.Length - 1) {}
  stream.Read(definition, 0, CInt(stream.Length))
  stream.Close()
    Catch e As IOException
        Console.WriteLine(e.Message)
    End Try

    Try
        rs.CreateCatalogItem("Report", REPORTNAME, REPORTSERVER_FOLDER, True, definition, Nothing, warnings)

        If Not (warnings Is Nothing) Then
            Dim warning As Warning
   
            For Each warning In warnings
                Console.WriteLine(warning.Message)
            Next warning
        Else
            Console.WriteLine("Report: {0} uploaded successfully to {1} with no warnings", REPORTNAME, REPORTSERVER_FOLDER)
        End If
    Catch e As Exception
        Console.WriteLine(e.Message)
    End Try
 End Sub

 

신고
Posted by webmars

티스토리 툴바