Accessing CodePlex WorkItemStore via TFS API?

Feb 16, 2008 at 3:11 PM
Hello,

I'm working on another codeplex project (http://www.codeplex.com/yakshaver) and would like to automatically create work items to the tracking service. I had read some other posts that I could simply use the TFS API to contact the service but my initial tests have been unsuccessful. Here is some of my code

Initially to connect:
_teamFoundationServer = TeamFoundationServerFactory.GetServer(CodePlexServerName, new CodePlexCredentialsProvider());

Here is my code for the fall back provider.

public System.Net.ICredentials GetCredentials(Uri uri, System.Net.ICredentials failedCredentials)
{

Debug.WriteLine("Get Credetnials URI: " + uri.ToString());
Debug.WriteLine("Failed Credentials: " + failedCredentials.ToString());

CodePlexProjectInfoSvc.ProjectInfoServiceSoapClient infoService = new YakShaver.CodePlex.CodePlexProjectInfoSvc.ProjectInfoServiceSoapClient();
string username = infoService.CodePlexUserNameToTfsUserName("cege7480");

System.Net.NetworkCredential nCredential =
new System.Net.NetworkCredential(username, "<password>");
return nCredential;

}

I see the GetCredentials being called multiple times and then I get an error

TF31003: Your user account does not have permission to connect to the Team Foundation Server https://tfs06.codeplex.com. Contact your Team Foundation Server administrator and request that the appropriate permission be added to your account.

Sooooooooo... it would appear my code is working fine, I'm just missing some permissions........... Ummmm... What would it take to get those permissions. Again you can see everything I'm doing with this project, it's open source for the world and I'm even blogging the details. I think this could be a powerful add-on for both codeplex and TFS... Am I selling you yet? ;)

Thanks,
Chris
Feb 24, 2008 at 10:21 PM
When you create your NetworkCredential object, try using the constructor that takes three parameters and pass "snd" for the domain parameter.
Feb 25, 2008 at 1:22 PM
I did a post on this on my blog a couple months back. The code here should get you going in the direction you need.