How to update a WorkItem automatically with a WCF web service


  • Hi there,

    I don't know if I'm right in this topic, but let me explain:

    At the moment i'm building a WCF webservice based on this tutorial:

    The goal of the Service is, after a WorkItem is created or changed, to set a specific ID into a custom field and update the Analysis-Field with the information of the "New Information" field.

    for these jobs i got functions which works fine. Now I subscribed the Service which should execute the functions. But when I change and save/create the Work Items, nothing happened.

    For your information, i give you the code:

    public void WorkItemEventCatcher(string eventXml)
                //Get the Team Project with the CRQs from your Server
                TfsTeamProjectCollection infoteamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://win-gs9gmujits8:8080/tfs/DefaultCollection"));
                //Get the CRQ Workitems you need
                WorkItemStore WorkitemCRQStore = (WorkItemStore)infoteamProjectCollection.GetService(typeof(WorkItemStore));
                //Get the ID of the changed WorkItem
                var workItemId = EventXmlHelper.GetWorkItemValue<int>(eventXml, EventXmlHelper.FieldSection.CoreFields, 
                                                                                EventXmlHelper.ValueType.NewValue, "System.Id");
                WorkItem workitem = WorkitemCRQStore.GetWorkItem(workItemId);
                if (workItemId != 0)
                    //Set the date and the abbreviation of the change
                    CRQAnalysisDateName.CRQAnalysis crqAnalysis = new CRQAnalysisDateName.CRQAnalysis();
                    //set the CRQ Number
                    CRQEnumerations.Enumeration crq = new Enumeration();

    The EventXmlHelper class is like the one in the tutorial.

    May somebody knows where my Problem lies. Thank you for your answers

    Best Regards,


    • Изменено itMBr 15 февраля 2012 г. 14:59
    15 февраля 2012 г. 14:58

Все ответы

  • Marco,

    Did you check the Event Log?
    Did you try to debug the w3wp process to see if the WCF service is called at all?

    Please remember to mark the replies as answers if they help. --- Success, Damir

    15 февраля 2012 г. 21:54
  • Hi Damir,

    I now checked the Event Log and tried to debug with w3wp.exe.

    When I debug my Service with the w3wp, create a new Work Item and save it, nothing happened. In the IntelliTrace I see no Event or Exception or anything. And when I set a breakpoint in the Service, I get the message  "The breakpoint will not currently be hit. No symbols have been loaded for this document". When I look in Debug->Windows->Modules, there are some Modules like "kjw3vtqv" or "5i1g4un5", ther symbol Status is "No symbols loaded".

    The versions of the Files on the IIS and in the Project are the same. The .pdb and .dll-files are in the IIS, too.

    I also tried to load the Symbols manually in Tools->Options in the Debugging->Symbols settings, but nothing worked.

    May you know where my Problem is?

    Best regards,


    • Изменено itMBr 17 февраля 2012 г. 11:39
    17 февраля 2012 г. 11:35
  • Marco,

    Maybe the problem is in the subscription that you have made? How did you subscribe for the event?

    Please remember to mark the replies as answers if they help. --- Success, Damir

    17 февраля 2012 г. 21:23
  • Hi Damir,

    I did it with BisSubscribe.exe: "BisSubscribe.exe /eventType WorkItemChangedEvent /address http://localhost:1222/WCFCRQService/Service1.svc /collection http://localhost:8080/tfs/DefaultCollection

    I'm not sure if I wrote it with the "WCFCRQService" or without, though BisSubscribe.exe accepted it.

    18 февраля 2012 г. 17:14
  • Hey guys,

    I found the problem why I could not debug the Service. The Service was hosted in the IIS in an application and not in the Website (like a subfolder). I changed it and now i can debug.

    Now I get a new problem: When I get in the Service, my parameter "eventXml" doesn't get any value from the TFS, so it is "null". So maybe somebody know how I get the String I need for my parameter?

    I hope I get a soon answer.

    Best Regards


    1 марта 2012 г. 10:19