Reputation: 1067
My project in VS is connected to VS Portal. I'm going to add work items programmatically using C#. Here is the snipped of code:
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace CSTFSWorkItemObjectModel
{
class Program
{
static void Main(string[] args)
{
var tfsUrl = ConfigurationManager.AppSettings["TfsUrl"];
var tfs = TeamFoundationServerFactory.GetServer(tfsUrl);
// WorkItemStore instance.
var wis = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
// Read project name form the application configuration file
var projectName = ConfigurationManager.AppSettings["TeamProject"];
EnsureWITImported(wis, projectName);
var project = wis.Projects[projectName];
var id = CreateWorkItem(project);
var wi = GetWorkItem(wis, id);
EditWorkItem(wi);
QueryWorkItems(wis, projectName);
Guid queryGuid = EnsureWIQueryCreated(wis, project);
QueryWorkItemAsynchronously(wis, queryGuid, project);
}
}
}
What is my TfsUrl? I have app.config file where I specify TfsUrl and TeamProject credentials. I tried to use TfsUrl as 'http://account.visualstudio.com but it didn't work. When I go to Team menu I see 'Disconnect from Team Foundation Server", so it means I'm connected now. Please help me.
Upvotes: 3
Views: 31257
Reputation: 52290
Upvotes: 3