c# - insert work item into tfs using tfs api -
i building web page insert tfs work items tfs using tfs api.
i using credentials connect tfs server.
each time creates tfs work item using tfs web page, creates work item under name ,since 1 connected tfs server. there way can create work item user logged web application , created work item ?
i have access users name not users password
protected void formview1_iteminserting(object sender, formviewinserteventargs e) { uri url = new uri("url"); networkcredential nc = new networkcredential(); tfsteamprojectcollection coll = new tfsteamprojectcollection(url, nc); coll.ensureauthenticated(); workitemstore workitemstore = coll.getservice<workitemstore>(); project teamproject = workitemstore.projects["abc"]; workitemtype workitemtype = teamproject.workitemtypes["issue"]; workitem wi = new workitem(workitemtype); wi.title = ((textbox)formview1.findcontrol("txttasktitle")).text; wi.save(); }
can please tell me can have name of person logged application 1 created tfs work item ?
i tried following :
uri url = new uri("url"); var collection = tfsteamprojectcollectionfactory.getteamprojectcollection(url); var workitemstore = new workitemstore(collection, workitemstoreflags.bypassrules); project teamproject = workitemstore.projects["abc"]; workitemtype workitemtype = teamproject.workitemtypes["issue"]; workitem wi = new workitem(workitemtype); string s = "name"; wi.fields["system.createdby"].value = s; wi.title = "test item"; wi.save();
try this:
tfsteamprojectcollection coll = new tfsteamprojectcollection(url,credentialcache.defaultcredentials);
get rid of whole network credential thing.
Comments
Post a Comment