Home

How to Manage VSTS Bugs using Flow and SharePoint, Part 1: Creating A Defect

%3CLINGO-SUB%20id%3D%22lingo-sub-89470%22%20slang%3D%22en-US%22%3EHow%20to%20Manage%20VSTS%20Bugs%20using%20Flow%20and%20SharePoint%2C%20Part%201%3A%20Creating%20A%20Defect%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-89470%22%20slang%3D%22en-US%22%3E%3CP%3EVisual%20Studio%20Team%20Services%20(VSTS)%20is%20great%20for%20managing%20development%20and%20testing%20activities.%20It%20is%20easy%20to%20track%20the%20progress%20of%20the%20work%20and%20get%20notifications%20about%20any%20changes.%20However%2C%20when%20it%20comes%20external%20users%2C%20it%20can%20be%20a%20bit%20more%20complex.%20I%20typically%20use%20SharePoint%20project%20sites%20for%20most%20of%20my%20client%20communication%20and%20collaboration%2C%20such%20as%20sharing%20of%20documents%2C%20project%20plans%2C%20and%20risks%20logs.%20Thus%2C%20it%20would%20be%20natural%20to%20also%20leverage%20the%20project%20sites%20for%20managing%20any%20defects%20that%20clients%20discover%20in%20their%20custom%20solutions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E2-System%20Solution%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EI%E2%80%99m%20a%20firm%20believer%20of%20working%20out%20loud%20and%20collaborating%20with%20clients.%20However%2C%20there%E2%80%99s%20also%20a%20time%20when%20I%20want%20to%20keep%20the%20internal%20development%20workings%20hidden%20from%20clients%20on%20purpose%20as%20it%20may%20cause%20unnecessary%20confusion%20or%20raise%20false%20alarm%20bells.%20Without%20having%20clients%20access%20VSTS%20directly%2C%20how%20will%20clients%20track%20bugs%3F%20I%20already%20alluded%20to%20the%20fact%20that%20I%20use%20SharePoint%20project%20sites%20for%20managing%20all%20other%20project%20related%20artefacts.%20Using%20a%20Custom%20List%20in%20SharePoint%2C%20I%20track%20key%20information%20about%20a%20defect%2C%20including%20Title%2C%20Reproducible%20Steps%2C%20Sprint%20Number%2C%20Priority%2C%20Severity%2C%20Browser%2C%20and%20Operating%20System.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20a%20defect%20is%20created%20or%20updated%20in%20SharePoint%2C%20I%20used%20to%20get%20notified%20about%20it%20and%20would%20then%20update%20the%20corresponding%20information%20in%20VSTS.%20This%20solution%20works%20but%20is%20not%20ideal%20as%20I%20it%20requires%20manual%20transcription%20of%20information%20and%20extra%20time.%20In%20the%20remaining%20sections%2C%20I%20discuss%20approaches%20for%20creating%20defects%20between%20SharePoint%20and%20VSTS.%20Below%20is%20a%20sample%20of%20what%20a%20VSTS%20Bug%20submission%20looks%20like%20(NOTE%3A%20there%20are%20many%20fields%20that%20can%20be%20filled-in%20when%20submitting%20a%20bug%20in%20VSTS.%20However%2C%20I%E2%80%99m%20only%20interested%20in%20the%20fields%20highlighted%20in%20yellow).%20From%20the%20defect%20fields%20mentioned%20above%2C%20the%20Browser%20and%20Operating%20System%20values%20make%20up%20the%20System%20Info%20field.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17572i2280041118FAF0F3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22VSTS%20Bug.JPG%22%20title%3D%22VSTS%20Bug.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAutomating%20Defect%20Creation%20using%20Flow%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ERecently%2C%20Microsoft%20introduced%20connectors%20for%20Visual%20Studio%20into%20Flow.%20One%20of%20the%20connectors%2C%20%3CEM%3ECreate%20a%20new%20work%20item%3C%2FEM%3E%2C%20can%20be%20used%20to%20submit%20bugs.%20The%20fields%20available%20for%20the%20submission%20can%20be%20seen%20in%20the%20image%20below.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20607px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17578iD912D9950459B602%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22VSTS%20Connector.JPG%22%20title%3D%22VSTS%20Connector.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThough%20functional%2C%20this%20connector%20only%20lets%20you%20set%20a%20few%20fields%20as%20shown%20above.%20The%20most%20logical%20field%20to%20provide%20all%20the%20details%20would%20be%20in%20the%20%3CEM%3EDescription%20%3C%2FEM%3Efield.%20However%2C%20this%20field%20is%20not%20shown%20in%20the%20Details%20view.%20To%20see%20the%20%3CEM%3EDescription%3C%2FEM%3E%2C%20you%20need%20to%20first%20go%20to%20the%20history%20view.%20Not%20ideal.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ERESTful%20Solution%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ELuckily%2C%20VSTS%20has%20a%20rich%20REST%20interface%20that%20can%20be%20leveraged%20to%20submit%20bugs%20with%20more%20detailed%20information.%20Setting%20up%20this%20Flow%20requires%20two%20prerequisites%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ECreate%20personal%20access%20tokens%20to%20authenticate%20access%20to%20VSTS%3C%2FLI%3E%0A%3CLI%3EConvert%20personal%20access%20token%20to%20Base%2064%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ECreate%20personal%20access%20tokens%20to%20authenticate%20access%20to%20VSTS%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETo%20read%20or%20write%20data%20to%20VSTS%2C%20the%20Flow%20must%20first%20authenticate%20with%20the%20service.%20This%20access%20can%20be%20established%20in%20a%20number%20of%20ways.%20In%20this%20example%2C%20I%20used%20the%20%3CEM%3EPersonal%20Access%20Token%3C%2FEM%3E.%20You%20can%20set%20up%20your%20access%20token%20by%20following%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.visualstudio.com%2Fen-us%2Fdocs%2Fintegrate%2Fget-started%2Fauthentication%2Fpats%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAuthenticating%20with%20personal%20access%20tokens%3C%2FA%3E%20instructions.%3C%2FP%3E%0A%3CP%3ENote%3A%20The%20maximum%20time%20span%20for%20a%20Personal%20Access%20Token%20is%201%20year%20from%20creation%20date.%20Make%20sure%20to%20consider%20it%20in%20case%20your%20need%20for%20this%20Flow%20will%20extend%20beyond%20a%20year.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EConvert%20Personal%20Access%20Token%20to%20Base%2064%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EBefore%20you%20are%20able%20to%20use%20your%20%3CEM%3EPersonal%20Access%20Token%3C%2FEM%3E%2C%20you%20have%20to%20convert%20it%20to%20Base%2064.%20You%20can%20use%20the%20following%20PowerShell%20command%20to%20achieve%20this%2C%20as%20described%20in%20Jeff%20Bramwell%E2%80%99s%20article%20%3CA%20href%3D%22http%3A%2F%2Fblog.devmatter.com%2Fcalling-vsts-apis-with-powershell%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ECalling%20VSTS%20APIs%20with%20PowerShell%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%24base64AuthInfo%20%3D%20%5BConvert%5D%3A%3AToBase64String(%5BText.Encoding%5D%3A%3AASCII.GetBytes((%22%7B0%7D%3A%7B1%7D%22%20-f%20%24user%2C%24token)))%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20you%20have%20your%20Personal%20Access%20Token%20in%20it%E2%80%99s%20proper%20format%2C%20let%E2%80%99s%20look%20at%20setting%20up%20SharePoint%20and%20the%20Flow%20itself.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20634px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17574iE377B8FE1AE242CE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22VSTS%20Flow.JPG%22%20title%3D%22VSTS%20Flow.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESetting%20Up%20SharePoint%20and%20Flow%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EAs%20mentioned%20earlier%20in%20this%20article%2C%20I%20am%20leveraging%20a%20SharePoint%20Custom%20List%20for%20my%20external%20users%20to%20submit%20their%20bugs.%20In%20my%20specific%20scenario%2C%20I%20use%20the%20following%20fields%3A%3C%2FP%3E%0A%3CTABLE%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3E%3CSTRONG%3EField%20Name%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%3CSTRONG%3EType%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%3CSTRONG%3EOptions%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%3CSTRONG%3ERequired%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3ETitle%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ESingle%20line%20of%20text%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EYes%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EReproducible%20Steps%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EMultiple%20lines%20of%20text%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ERich%20Text%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ENo%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EBrowser%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EChoice%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EIE11%3C%2FP%3E%0A%3CP%3EChrome%3C%2FP%3E%0A%3CP%3ESafari%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ENo%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EOperating%20System%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EChoice%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EWindows%2010%3C%2FP%3E%0A%3CP%3EiOS%3C%2FP%3E%0A%3CP%3EAndroid%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ENo%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EPriority%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EChoice%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E1%3C%2FP%3E%0A%3CP%3E2%3C%2FP%3E%0A%3CP%3E3%3C%2FP%3E%0A%3CP%3E4%3C%2FP%3E%0A%3CP%3E5%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ENo%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3ESeverity%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EChoice%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E1-%20Critical%3C%2FP%3E%0A%3CP%3E2-%20High%3C%2FP%3E%0A%3CP%3E3-%20Medium%3C%2FP%3E%0A%3CP%3E4-%20Low%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ENo%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EAcceptance%20Criteria%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EMultiple%20lines%20of%20text%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ERich%20text%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ENo%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3ESprint%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EChoice%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ESprint%201%3C%2FP%3E%0A%3CP%3ESprint%202%3C%2FP%3E%0A%3CP%3ESprint%203%3C%2FP%3E%0A%3CP%3ESprint%204%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ENo%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EVSTS%20Bug%20ID%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ENumber%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMost%20of%20this%20information%20is%20straight%20forward%2C%20but%20I%20want%20to%20call%20out%20two%20specific%20points.%20First%2C%20you%20may%20have%20noticed%20that%20the%20values%20for%20%3CEM%3EPriority%3C%2FEM%3E%20and%20%3CEM%3ESeverity%3C%2FEM%3E%20are%20different.%20This%20is%20because%2C%20although%20similar%20in%20categorization%2C%20I%20wanted%20to%20match%20the%20values%20that%20are%20present%20in%20VSTS%20to%20make%20it%20easier%20for%20someone%20looking%20at%20a%20bug%20in%20SharePoint%20and%20VSTS%20to%20see%20the%20relationship%20without%20needing%20to%20do%20any%20mental%20transformation%20of%20the%20values.%20I%20could%20have%20used%20a%20simple%20numbering%20scheme%20(or%20altogether%20different%20values%20for%20that%20matter).%20The%20second%20field%20is%20the%20%3CEM%3EVSTS%20Bug%20ID%3C%2FEM%3E.%20This%20field%20is%20used%20to%20capture%20the%20ID%20of%20the%20bug%20that%20was%20just%20created%20by%20the%20Flow.%20In%20a%20later%20article%2C%20I%E2%80%99ll%20discuss%20how%20you%20can%20use%20it%20to%20update%20an%20existing%20Bug.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%2C%20let%E2%80%99s%20have%20a%20look%20at%20the%20Flow.%20It%20is%20fairly%20straight%20forward%20and%20linear%2C%20with%20a%20single%20path%20of%20actions.%3C%2FP%3E%0A%3CP%3EThe%20Flow%20is%20composed%20of%20a%20trigger%20and%204%20steps.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EWhen%20a%20new%20item%20is%20created%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EHere%2C%20I%20simply%20set%20up%20the%20trigger%20for%20a%20new%20item%20that%20is%20created%20in%20the%20Custom%20List%20in%20SharePoint.%20Once%20an%20item%20is%20created%2C%20the%20Flow%20kicks-in.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EInitialize%20variable%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EIn%20this%20step%2C%20I%20save%20my%20Base%2064%20Personal%20Access%20Token%20in%20a%20variable%20for%20later%20reference.%20This%20is%20good%20practice%20in%20case%20you%20have%20to%20alter%20it%20(and%20you%20will%2C%20at%20least%20once%20a%20year)%20without%20needing%20to%20search%20for%20the%20tokens%20inside%20all%20of%20your%20code.%20I%20called%20my%20variable%20%3CEM%3EVSTS%20Authorization.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EHTTP%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThis%20is%20where%20the%20magic%20happens.%20Make%20sure%20to%20provide%20the%20correct%20field%20values%20(Method%2C%20Uri%2C%20Headers%2C%20Body%2C%20Authentication)%20to%20avoid%20errors%20from%20occurring%20during%20the%20submission.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20595px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17575i4487CB08DD6FADC1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22VSTS%20Header.JPG%22%20title%3D%22VSTS%20Header.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20my%20case%2C%20I%20have%20the%20following%20mapping%20between%20the%20SharePoint%20list%20and%20VSTS%3A%3C%2FP%3E%0A%3CTABLE%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3E%3CSTRONG%3ESharePoint%20Custom%20List%20Field%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3E%3CSTRONG%3EVSTS%20Field%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3ESprint%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ESystem.IterationPath%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3ECreated%20By%20Email%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ESystem.CreatedBy%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3ETitle%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ESystem.Title%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EReproducible%20Steps%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EVSTS.TCM.ReproSteps%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EPriority%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EVSTS.Common.Priority%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3ESeverity%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EVSTS.Common.Severity%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EBrowser%20and%20Operating%20System%20(combined%20and%20formatted%20using%20HTML)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EVSTS.TCM.SystemInfo%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20more%20options%20available%20to%20populate%20fields%20in%20VSTS.%20For%20a%20full%20reference%2C%20refer%20to%20the%20VSTS%20%3CA%20href%3D%22https%3A%2F%2Fwww.visualstudio.com%2Fen-us%2Fdocs%2Fwork%2Fguidance%2Fwork-item-field%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EWork%20item%20field%20index%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20467px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17576i482DE226F43D4082%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22VSTS%20REST.png%22%20title%3D%22VSTS%20REST.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20next%20step%20in%20the%20Flow%20captures%20the%20response%20from%20the%20REST%20PATCH%20message%20and%20parses%20out%20the%20fields%20of%20the%20Bug%20created%20in%20VSTS.%20To%20get%20the%20schema%2C%20click%20%3CEM%3EUse%20sample%20payload%20to%20generate%20schema%20%3C%2FEM%3Eand%20copy%20the%20%3CEM%3EBody%3C%2FEM%3E%20of%20the%20HTTP%20action.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20493px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17577i3F2BA70540F2079E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22VSTS%20Parse.JPG%22%20title%3D%22VSTS%20Parse.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFinally%2C%20I%20update%20the%20original%20SharePoint%20Custom%20List%20item%20with%20the%20newly%20created%20VSTS%20Bug%20ID.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EConsiderations%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EAs%20mentioned%20earlier%2C%20one%20of%20the%20limitations%20of%20this%20approach%20is%20using%20the%20Personal%20Access%20Token%20as%20it%20expires%20after%20no%20more%20than%20a%20year%20of%20its%20creation.%20One%20way%20to%20manage%20it%20without%20having%20to%20modify%20the%20Flow%20is%20by%20storing%20it%20in%20another%20location%20(e.g.%20SharePoint%20list)%20and%20referencing%20it%20in%20the%20Flow.%20There%20are%20other%20ways%20to%20authenticate%2C%20which%20are%20beyond%20the%20scope%20of%20this%20article.%3C%2FP%3E%0A%3CP%3EAnother%20interesting%20consideration%20is%20that%20if%20properly%20architected%2C%20you%20could%20use%20a%20single%20Flow%20to%20service%20multiple%20VSTS%20projects%20from%20a%20single%20SharePoint%20entry%20point%20by%20parameterizing%20the%20VSTS%20Uri%20and%20AreaPath%20and%20keeping%20the%20IterationPath%20consistent%20(e.g.%20Sprint%20numbers).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-89470%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Haniel Croitoru
MVP

Visual Studio Team Services (VSTS) is great for managing development and testing activities. It is easy to track the progress of the work and get notifications about any changes. However, when it comes external users, it can be a bit more complex. I typically use SharePoint project sites for most of my client communication and collaboration, such as sharing of documents, project plans, and risks logs. Thus, it would be natural to also leverage the project sites for managing any defects that clients discover in their custom solutions.

 

2-System Solution

I’m a firm believer of working out loud and collaborating with clients. However, there’s also a time when I want to keep the internal development workings hidden from clients on purpose as it may cause unnecessary confusion or raise false alarm bells. Without having clients access VSTS directly, how will clients track bugs? I already alluded to the fact that I use SharePoint project sites for managing all other project related artefacts. Using a Custom List in SharePoint, I track key information about a defect, including Title, Reproducible Steps, Sprint Number, Priority, Severity, Browser, and Operating System.

 

When a defect is created or updated in SharePoint, I used to get notified about it and would then update the corresponding information in VSTS. This solution works but is not ideal as I it requires manual transcription of information and extra time. In the remaining sections, I discuss approaches for creating defects between SharePoint and VSTS. Below is a sample of what a VSTS Bug submission looks like (NOTE: there are many fields that can be filled-in when submitting a bug in VSTS. However, I’m only interested in the fields highlighted in yellow). From the defect fields mentioned above, the Browser and Operating System values make up the System Info field.

 

VSTS Bug.JPG

 

 

 

Automating Defect Creation using Flow

Recently, Microsoft introduced connectors for Visual Studio into Flow. One of the connectors, Create a new work item, can be used to submit bugs. The fields available for the submission can be seen in the image below.

 

 

VSTS Connector.JPG

 

 

 

Though functional, this connector only lets you set a few fields as shown above. The most logical field to provide all the details would be in the Description field. However, this field is not shown in the Details view. To see the Description, you need to first go to the history view. Not ideal.

 

RESTful Solution

Luckily, VSTS has a rich REST interface that can be leveraged to submit bugs with more detailed information. Setting up this Flow requires two prerequisites:

  • Create personal access tokens to authenticate access to VSTS
  • Convert personal access token to Base 64

 

Create personal access tokens to authenticate access to VSTS

To read or write data to VSTS, the Flow must first authenticate with the service. This access can be established in a number of ways. In this example, I used the Personal Access Token. You can set up your access token by following the Authenticating with personal access tokens instructions.

Note: The maximum time span for a Personal Access Token is 1 year from creation date. Make sure to consider it in case your need for this Flow will extend beyond a year.

 

Convert Personal Access Token to Base 64

Before you are able to use your Personal Access Token, you have to convert it to Base 64. You can use the following PowerShell command to achieve this, as described in Jeff Bramwell’s article Calling VSTS APIs with PowerShell.

 

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))

 

Now that you have your Personal Access Token in it’s proper format, let’s look at setting up SharePoint and the Flow itself.

 

VSTS Flow.JPG

 

 

Setting Up SharePoint and Flow

As mentioned earlier in this article, I am leveraging a SharePoint Custom List for my external users to submit their bugs. In my specific scenario, I use the following fields:

Field Name

Type

Options

Required

Title

Single line of text

 

Yes

Reproducible Steps

Multiple lines of text

Rich Text

No

Browser

Choice

IE11

Chrome

Safari

No

Operating System

Choice

Windows 10

iOS

Android

No

Priority

Choice

1

2

3

4

5

No

Severity

Choice

1- Critical

2- High

3- Medium

4- Low

No

Acceptance Criteria

Multiple lines of text

Rich text

No

Sprint

Choice

Sprint 1

Sprint 2

Sprint 3

Sprint 4

No

VSTS Bug ID

Number

 

 

 

Most of this information is straight forward, but I want to call out two specific points. First, you may have noticed that the values for Priority and Severity are different. This is because, although similar in categorization, I wanted to match the values that are present in VSTS to make it easier for someone looking at a bug in SharePoint and VSTS to see the relationship without needing to do any mental transformation of the values. I could have used a simple numbering scheme (or altogether different values for that matter). The second field is the VSTS Bug ID. This field is used to capture the ID of the bug that was just created by the Flow. In a later article, I’ll discuss how you can use it to update an existing Bug.

 

Now, let’s have a look at the Flow. It is fairly straight forward and linear, with a single path of actions.

The Flow is composed of a trigger and 4 steps.

 

 

When a new item is created

Here, I simply set up the trigger for a new item that is created in the Custom List in SharePoint. Once an item is created, the Flow kicks-in.

 

Initialize variable

In this step, I save my Base 64 Personal Access Token in a variable for later reference. This is good practice in case you have to alter it (and you will, at least once a year) without needing to search for the tokens inside all of your code. I called my variable VSTS Authorization.

 

HTTP

This is where the magic happens. Make sure to provide the correct field values (Method, Uri, Headers, Body, Authentication) to avoid errors from occurring during the submission.

 

VSTS Header.JPG

 

 

In my case, I have the following mapping between the SharePoint list and VSTS:

SharePoint Custom List Field

VSTS Field

Sprint

System.IterationPath

Created By Email

System.CreatedBy

Title

System.Title

Reproducible Steps

VSTS.TCM.ReproSteps

Priority

VSTS.Common.Priority

Severity

VSTS.Common.Severity

Browser and Operating System (combined and formatted using HTML)

VSTS.TCM.SystemInfo

 

There are more options available to populate fields in VSTS. For a full reference, refer to the VSTS Work item field index.

 

VSTS REST.png

 

 

 

The next step in the Flow captures the response from the REST PATCH message and parses out the fields of the Bug created in VSTS. To get the schema, click Use sample payload to generate schema and copy the Body of the HTTP action.

 

VSTS Parse.JPG

 

 

Finally, I update the original SharePoint Custom List item with the newly created VSTS Bug ID.

 

Considerations

As mentioned earlier, one of the limitations of this approach is using the Personal Access Token as it expires after no more than a year of its creation. One way to manage it without having to modify the Flow is by storing it in another location (e.g. SharePoint list) and referencing it in the Flow. There are other ways to authenticate, which are beyond the scope of this article.

Another interesting consideration is that if properly architected, you could use a single Flow to service multiple VSTS projects from a single SharePoint entry point by parameterizing the VSTS Uri and AreaPath and keeping the IterationPath consistent (e.g. Sprint numbers).