3

Working with C# and Team Foundation Server

I am working on a webservice that will allow Microsoft CRM to create a workitem in TFS without having to use TFS interface. Everything is working smoothly except for one thing.

Is there a way to know in what TFS project a Contact is working with a Contact object? I can get a contact object from a guid using this line :

Contact contact = context.ContactSet.Where(x => x.Id == guid).FirstOrDefault();

where context is the actual XrmServiceContext and guid a specified contact Guid...

using the retrieved object, how can I get information about the TFS project in which the contact is working on? It can be the project name, a Project object, anything really. I'll figure the rest myself, I just need to find the relationship between Project and Contact.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Érik Desjardins
  • 993
  • 1
  • 12
  • 25
  • Why would there be a relationship between contact and team project? For instance, I work on several team projects at once. – John Saunders Mar 21 '12 at 15:25
  • Because when I create the workitem via C#, I need to know in what project the workitem should be created. In order to do that, I need to know in what project the contact who wants to create the workitem is currently working. Maybe I am totally off-track. – Érik Desjardins Mar 21 '12 at 19:03
  • 1
    You have the relationships wrong. A person can work on several projects, in general. – John Saunders Mar 21 '12 at 19:31
  • You are right, a user can have more than only one project. Feel free to answer the question with that so I can give you reputation and accept the answer. – Érik Desjardins Mar 22 '12 at 14:40

1 Answers1

1

Unfortunately, this doesn't make sense, as a contact may work on more than one team project.

You haven't said what context this is happening in. Perhaps the context could tell you which project to use. For instance, if you were recording a customer call in a work item, then you might be able to choose the project based on which product line the customer is calling about.

John Saunders
  • 160,644
  • 26
  • 247
  • 397