Produced by Araxis Merge on 2/1/2017 2:56:55 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\CS\VisualizationsAndDashboards | CRUDVisualizations.cs | Tue Dec 20 19:51:43 2016 UTC |
| 2 | Wed Feb 1 19:56:55 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 454 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 2 | // | |||||
| 3 | // This f ile is par t of the M icrosoft D ynamics CR M SDK code samples. | |||||
| 4 | // | |||||
| 5 | // Copyri ght (C) Mi crosoft Co rporation. All righ ts reserve d. | |||||
| 6 | // | |||||
| 7 | // This s ource code is intend ed only as a supplem ent to Mic rosoft | |||||
| 8 | // Develo pment Tool s and/or o n-line doc umentation . See the se other | |||||
| 9 | // materi als for de tailed inf ormation r egarding M icrosoft c ode sample s. | |||||
| 10 | // | |||||
| 11 | // THIS C ODE AND IN FORMATION ARE PROVID ED "AS IS" WITHOUT W ARRANTY OF ANY | |||||
| 12 | // KIND, EITHER EXP RESSED OR IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E | |||||
| 13 | // IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR A | |||||
| 14 | // PARTIC ULAR PURPO SE. | |||||
| 15 | // | |||||
| 16 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 17 | //<snippet CRUDVisual ization> | |||||
| 18 | using Syst em; | |||||
| 19 | using Syst em.Linq; | |||||
| 20 | using Syst em.Service Model; | |||||
| 21 | using Syst em.Service Model.Desc ription; | |||||
| 22 | ||||||
| 23 | // These n amespaces are found in the Mic rosoft.Xrm .Sdk.dll a ssembly | |||||
| 24 | // found i n the SDK\ bin folder . | |||||
| 25 | using Micr osoft.Xrm. Sdk; | |||||
| 26 | using Micr osoft.Xrm. Sdk.Client ; | |||||
| 27 | using Micr osoft.Xrm. Sdk.Query; | |||||
| 28 | using Micr osoft.Xrm. Sdk.Discov ery; | |||||
| 29 | using Micr osoft.Xrm. Sdk.Messag es; | |||||
| 30 | ||||||
| 31 | // This na mespace is found in Microsoft. Crm.Sdk.Pr oxy.dll as sembly | |||||
| 32 | // found i n the SDK\ bin folder . | |||||
| 33 | using Micr osoft.Crm. Sdk.Messag es; | |||||
| 34 | ||||||
| 35 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 36 | { | |||||
| 37 | /// <s ummary> | |||||
| 38 | /// Th is sample shows how to create retrieve, update, an d delete a n | |||||
| 39 | /// or ganization -owned vis ualization . The visu alization will be at tached | |||||
| 40 | /// to the 'Oppo rtunity' e ntity. As part of up dating the visualiza tion, | |||||
| 41 | /// we will also set it to be the de fault visu alization for the Op portunity | |||||
| 42 | /// en tity. | |||||
| 43 | /// </ summary> | |||||
| 44 | public class CRU DVisualiza tion | |||||
| 45 | { | |||||
| 46 | #r egion Clas s Level Me mbers | |||||
| 47 | ||||||
| 48 | ||||||
| 49 | // / <summary > | |||||
| 50 | // / Stores t he organiz ation serv ice proxy. | |||||
| 51 | // / </summar y> | |||||
| 52 | pr ivate Orga nizationSe rviceProxy _serviceP roxy; | |||||
| 53 | ||||||
| 54 | // Define th e IDs need ed for thi s sample. | |||||
| 55 | pr ivate Guid _orgOwned Visualizat ionId; | |||||
| 56 | pr ivate Guid _accountI d; | |||||
| 57 | pr ivate Guid [] _opport unitiyIds; | |||||
| 58 | ||||||
| 59 | #e ndregion C lass Level Members | |||||
| 60 | ||||||
| 61 | #r egion How To Sample Code | |||||
| 62 | // / <summary > | |||||
| 63 | // / Create a nd configu re the org anization service pr oxy. | |||||
| 64 | // / Initiate the metho d to creat e any data that this sample re quires. | |||||
| 65 | // / Create a n organiza tion-owned visualiza tion. | |||||
| 66 | // / Retrieve the visua lization. | |||||
| 67 | // / Update t he visuali zation; up date the n ame and se t it as th e default | |||||
| 68 | // / visualiz ation for the Opport unity enti ty. | |||||
| 69 | // / Optional ly delete any entity records t hat were c reated for this samp le. | |||||
| 70 | // / </summar y> | |||||
| 71 | // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param> | |||||
| 72 | // / <param n ame="promp tforDelete ">When Tru e, the use r will be prompted t o delete a ll | |||||
| 73 | // / created entities.< /param> | |||||
| 74 | ||||||
| 75 | pub lic void R un(ServerC onnection. Configurat ion server Config, bo ol promptF orDelete) | |||||
| 76 | { | |||||
| 77 | try | |||||
| 78 | { | |||||
| 79 | // C onnect to the Organi zation ser vice. | |||||
| 80 | // T he using s tatement a ssures tha t the serv ice proxy will be pr operly dis posed. | |||||
| 81 | usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,server Config.Cre dentials, serverConf ig.DeviceC redentials )) | |||||
| 82 | { | |||||
| 83 | // This st atement is required to enable early-boun d type sup port. | |||||
| 84 | _servicePr oxy.Enable ProxyTypes (); | |||||
| 85 | ||||||
| 86 | ||||||
| 87 | // Call th e method t o create a ny data th at this sa mple requi res. | |||||
| 88 | CreateRequ iredRecord s(); | |||||
| 89 | ||||||
| 90 | //<snippet CRUDVisual ization1> | |||||
| 91 | // Create a visualiz ation | |||||
| 92 | ||||||
| 93 | // Set The presentat ion XML st ring. | |||||
| 94 | string pre sentationX ml = @" | |||||
| 95 | <Chart Pal ette='Brig htPastel'> | |||||
| 96 | <Serie s> | |||||
| 97 | <S eries _Tem plate_='Al l' ShadowO ffset='2' | |||||
| 98 | BorderCo lor='64, 6 4, 64' Bor derDashSty le='Solid' | |||||
| 99 | BorderWi dth='1' Is ValueShown AsLabel='t rue' | |||||
| 100 | Font='Ta homa, 6.75 pt, GdiCha rSet=0' | |||||
| 101 | LabelFor eColor='10 0, 100, 10 0' | |||||
| 102 | CustomPr operties=' FunnelLabe lStyle=Out side' | |||||
| 103 | ChartTyp e='Funnel' > | |||||
| 104 | <SmartLa belStyle E nabled='Tr ue' /> | |||||
| 105 | <Points /> | |||||
| 106 | </ Series> | |||||
| 107 | </Ser ies> | |||||
| 108 | <Chart Areas> | |||||
| 109 | <C hartArea _ Template_= 'All' Back Color='Tra nsparent' | |||||
| 110 | BorderCo lor='Trans parent' | |||||
| 111 | BorderDa shStyle='S olid'> | |||||
| 112 | <Area3DS tyle Enabl e3D='True' | |||||
| 113 | IsCl ustered='T rue'/> | |||||
| 114 | </ ChartArea> | |||||
| 115 | </Char tAreas> | |||||
| 116 | <Legen ds> | |||||
| 117 | <L egend _Tem plate_='Al l' Alignme nt='Center ' | |||||
| 118 | LegendSt yle='Table ' Docking= 'Bottom' | |||||
| 119 | IsEquall ySpacedIte ms='True' BackColor= 'White' | |||||
| 120 | BorderCo lor='228, 228, 228' BorderWidt h='0' | |||||
| 121 | Font='Ta homa, 8pt, GdiCharSe t=0' | |||||
| 122 | ShadowCo lor='0, 0, 0, 0' | |||||
| 123 | ForeColo r='100, 10 0, 100'> | |||||
| 124 | </ Legend> | |||||
| 125 | </Lege nds> | |||||
| 126 | <Title s> | |||||
| 127 | <T itle _Temp late_='All ' | |||||
| 128 | Font='Ta homa, 9pt, style=Bol d, GdiChar Set=0' | |||||
| 129 | ForeColo r='102, 10 2, 102'> | |||||
| 130 | </ Title> | |||||
| 131 | </Titl es> | |||||
| 132 | <Borde rSkin Page Color='Con trol' | |||||
| 133 | Ba ckColor='C ornflowerB lue' | |||||
| 134 | Ba ckSecondar yColor='Co rnflowerBl ue' /> | |||||
| 135 | </Chart> | |||||
| 136 | "; | |||||
| 137 | ||||||
| 138 | // Set the data XML string. | |||||
| 139 | string dat aXml = @" | |||||
| 140 | <datadefin ition> | |||||
| 141 | <fetch collection > | |||||
| 142 | <f etch mappi ng='logica l' count=' 10' | |||||
| 143 | aggregat e='true'> | |||||
| 144 | <entity name='oppo rtunity'> | |||||
| 145 | <att ribute nam e='actualv alue_base' | |||||
| 146 | aggregate= 'sum' | |||||
| 147 | alias='sum _actualval ue_base' / > | |||||
| 148 | <att ribute nam e='stepnam e' groupby ='true' | |||||
| 149 | alias='ste pname' /> | |||||
| 150 | <ord er alias=' stepname' descending ='false'/> | |||||
| 151 | </entity > | |||||
| 152 | </ fetch> | |||||
| 153 | </fetc hcollectio n> | |||||
| 154 | <categ orycollect ion> | |||||
| 155 | <c ategory> | |||||
| 156 | <measure collection > | |||||
| 157 | <mea sure alias ='sum_actu alvalue_ba se'/> | |||||
| 158 | </measur ecollectio n> | |||||
| 159 | </ category> | |||||
| 160 | </cate gorycollec tion> | |||||
| 161 | </datadefi nition> | |||||
| 162 | "; | |||||
| 163 | //<snippet CRUDVisual ization2> | |||||
| 164 | // Create the visual ization en tity insta nce. | |||||
| 165 | SavedQuery Visualizat ion newOrg OwnedVisua lization = new Saved QueryVisua lization | |||||
| 166 | { | |||||
| 167 | Name = "Sample V isualizati on", | |||||
| 168 | Descri ption = "S ample orga nization-o wned visua lization." , | |||||
| 169 | Presen tationDesc ription = presentati onXml, | |||||
| 170 | DataDe scription = dataXml, | |||||
| 171 | Primar yEntityTyp eCode = Op portunity. EntityLogi calName, | |||||
| 172 | IsDefa ult = fals e | |||||
| 173 | }; | |||||
| 174 | _orgOwnedV isualizati onId = _se rviceProxy .Create(ne wOrgOwnedV isualizati on); | |||||
| 175 | //</snippe tCRUDVisua lization2> | |||||
| 176 | Console.Wr iteLine("C reated {0} .", newOrg OwnedVisua lization.N ame); | |||||
| 177 | //</snippe tCRUDVisua lization1> | |||||
| 178 | ||||||
| 179 | // Retriev e the visu alization | |||||
| 180 | SavedQuery Visualizat ion retrie vedOrgOwne dVisualiza tion = (Sa vedQueryVi sualizatio n)_service Proxy.Retr ieve(Saved QueryVisua lization.E ntityLogic alName, _o rgOwnedVis ualization Id, new Co lumnSet(tr ue)); | |||||
| 181 | Console.Wr iteLine("R etrieved t he visuali zation."); | |||||
| 182 | ||||||
| 183 | // Update the retrie ved visual ization | |||||
| 184 | // 1. Upd ate the na me. | |||||
| 185 | // 2. Upd ate the da ta descrip tion strin g. | |||||
| 186 | ||||||
| 187 | string new DataXml = @"<datadef inition> | |||||
| 188 | <fetchcoll ection> | |||||
| 189 | <fetch mapping=' logical' c ount='10' | |||||
| 190 | ag gregate='t rue'> | |||||
| 191 | <e ntity name ='opportun ity'> | |||||
| 192 | <attribu te name='e stimatedva lue_base' | |||||
| 193 | aggr egate='sum ' | |||||
| 194 | alia s='sum_est imatedvalu e_base' /> | |||||
| 195 | <attribu te name='n ame' | |||||
| 196 | grou pby='true' | |||||
| 197 | alia s='name' / > | |||||
| 198 | <order a lias='name ' | |||||
| 199 | desc ending='fa lse'/> | |||||
| 200 | </ entity> | |||||
| 201 | </fetc h> | |||||
| 202 | </fetchcol lection> | |||||
| 203 | <categoryc ollection> | |||||
| 204 | <categ ory> | |||||
| 205 | <m easurecoll ection> | |||||
| 206 | <measure alias='su m_estimate dvalue_bas e'/> | |||||
| 207 | </ measurecol lection> | |||||
| 208 | </cate gory> | |||||
| 209 | </category collection > | |||||
| 210 | </da tadefiniti on>"; | |||||
| 211 | ||||||
| 212 | retrievedO rgOwnedVis ualization .Name = "U pdated Sam ple Visual ization"; | |||||
| 213 | retrievedO rgOwnedVis ualization .DataDescr iption = n ewDataXml; | |||||
| 214 | ||||||
| 215 | _servicePr oxy.Update (retrieved OrgOwnedVi sualizatio n); | |||||
| 216 | ||||||
| 217 | // Publish the chang es to the solution. This step is only re quired | |||||
| 218 | // for org anization- owned visu alizations . | |||||
| 219 | PublishAll XmlRequest updateReq uest = new PublishAl lXmlReques t(); | |||||
| 220 | _servicePr oxy.Execut e(updateRe quest); | |||||
| 221 | ||||||
| 222 | Console.Wr iteLine("U pdated the visualiza tion."); | |||||
| 223 | ||||||
| 224 | DeleteRequ iredRecord s(promptFo rDelete); | |||||
| 225 | ||||||
| 226 | } | |||||
| 227 | } | |||||
| 228 | // Catch any servi ce fault e xceptions that Micro soft Dynam ics CRM th rows. | |||||
| 229 | catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>) | |||||
| 230 | { | |||||
| 231 | // Y ou can han dle an exc eption her e or pass it back to the calli ng method. | |||||
| 232 | thro w; | |||||
| 233 | } | |||||
| 234 | } | |||||
| 235 | ||||||
| 236 | // / <summary > | |||||
| 237 | // / This met hod create s any enti ty records that this sample re quires. | |||||
| 238 | // / Create a n account and few op portuntiy records fo r sample d ata | |||||
| 239 | // / for the chart. | |||||
| 240 | // / </summar y> | |||||
| 241 | pu blic void CreateRequ iredRecord s() | |||||
| 242 | { | |||||
| 243 | // Creat e a sample account | |||||
| 244 | Account setupAccou nt = new A ccount { N ame = "Sam ple Accoun t" }; | |||||
| 245 | _account Id = _serv iceProxy.C reate(setu pAccount); | |||||
| 246 | Console. WriteLine( "Created { 0}.", setu pAccount.N ame); | |||||
| 247 | ||||||
| 248 | // Creat e some opp otunity re cords for the visual ization | |||||
| 249 | Opportun ity[] setu pOpportuni ties = new Opportuni ty[] | |||||
| 250 | { | |||||
| 251 | new Opport unity | |||||
| 252 | { | |||||
| 253 | Name = "Sample O pp 01", | |||||
| 254 | Estima tedValue = new Money (120000.00 m), | |||||
| 255 | Actual Value = ne w Money(10 0000.00m), | |||||
| 256 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 257 | _a ccountId), | |||||
| 258 | StepNa me = "Open " | |||||
| 259 | }, | |||||
| 260 | new Opport unity | |||||
| 261 | { | |||||
| 262 | Name = "Sample O pp 02", | |||||
| 263 | Estima tedValue = new Money (240000.00 m), | |||||
| 264 | Actual Value = ne w Money(20 0000.00m), | |||||
| 265 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 266 | _a ccountId), | |||||
| 267 | StepNa me = "Open " | |||||
| 268 | }, | |||||
| 269 | new Opport unity | |||||
| 270 | { | |||||
| 271 | Name = "Sample O pp 03", | |||||
| 272 | Estima tedValue = new Money (360000.00 m), | |||||
| 273 | Actual Value = ne w Money(30 0000.00m), | |||||
| 274 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 275 | _a ccountId), | |||||
| 276 | StepNa me = "Open " | |||||
| 277 | }, | |||||
| 278 | new Opport unity | |||||
| 279 | { | |||||
| 280 | Name = "Sample O pp 04", | |||||
| 281 | Estima tedValue = new Money (500000.00 m), | |||||
| 282 | Actual Value = ne w Money(50 0000.00m), | |||||
| 283 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 284 | _a ccountId), | |||||
| 285 | StepNa me = "Open " | |||||
| 286 | }, | |||||
| 287 | new Opport unity | |||||
| 288 | { | |||||
| 289 | Name = "Sample O pp 05", | |||||
| 290 | Estima tedValue = new Money (110000.00 m), | |||||
| 291 | Actual Value = ne w Money(60 000.00m), | |||||
| 292 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 293 | _a ccountId), | |||||
| 294 | StepNa me = "Open " | |||||
| 295 | }, | |||||
| 296 | new Opport unity | |||||
| 297 | { | |||||
| 298 | Name = "Sample O pp 06", | |||||
| 299 | Estima tedValue = new Money (90000.00m ), | |||||
| 300 | Actual Value = ne w Money(70 000.00m), | |||||
| 301 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 302 | _a ccountId), | |||||
| 303 | StepNa me = "Open " | |||||
| 304 | }, | |||||
| 305 | new Opport unity | |||||
| 306 | { | |||||
| 307 | Name = "Sample O pp 07", | |||||
| 308 | Estima tedValue = new Money (620000.00 m), | |||||
| 309 | Actual Value = ne w Money(48 0000.00m), | |||||
| 310 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 311 | _a ccountId), | |||||
| 312 | StepNa me = "Open " | |||||
| 313 | }, | |||||
| 314 | new Opport unity | |||||
| 315 | { | |||||
| 316 | Name = "Sample O pp 08", | |||||
| 317 | Estima tedValue = new Money (440000.00 m), | |||||
| 318 | Actual Value = ne w Money(40 0000.00m), | |||||
| 319 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 320 | _a ccountId), | |||||
| 321 | StepNa me = "Open " | |||||
| 322 | }, | |||||
| 323 | new Opport unity | |||||
| 324 | { | |||||
| 325 | Name = "Sample O pp 09", | |||||
| 326 | Estima tedValue = new Money (410000.00 m), | |||||
| 327 | Actual Value = ne w Money(40 0000.00m), | |||||
| 328 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 329 | _a ccountId), | |||||
| 330 | StepNa me = "Open " | |||||
| 331 | }, | |||||
| 332 | new Opport unity | |||||
| 333 | { | |||||
| 334 | Name = "Sample O pp 10", | |||||
| 335 | Estima tedValue = new Money (650000.00 m), | |||||
| 336 | Actual Value = ne w Money(65 0000.00m), | |||||
| 337 | Custom erId = new EntityRef erence(Acc ount.Entit yLogicalNa me, | |||||
| 338 | _a ccountId), | |||||
| 339 | StepNa me = "Open " | |||||
| 340 | } | |||||
| 341 | }; | |||||
| 342 | ||||||
| 343 | _opportu nitiyIds = (from opp in setupO pportuniti es | |||||
| 344 | select _ servicePro xy.Create( opp)).ToAr ray(); | |||||
| 345 | ||||||
| 346 | Console. WriteLine( "Created f ew opportu nity recor ds for {0} .", setupA ccount.Nam e); | |||||
| 347 | ||||||
| 348 | return; | |||||
| 349 | } | |||||
| 350 | ||||||
| 351 | // / <summary > | |||||
| 352 | // / Deletes any entity records t hat were c reated for this samp le. | |||||
| 353 | // / <param n ame="promp t">Indicat es whether to prompt the user | |||||
| 354 | // / to delet e the reco rds create d in this sample.</p aram> | |||||
| 355 | // / </summar y> | |||||
| 356 | pu blic void DeleteRequ iredRecord s(bool pro mpt) | |||||
| 357 | { | |||||
| 358 | bool del eteRecords = true; | |||||
| 359 | ||||||
| 360 | if (prom pt) | |||||
| 361 | { | |||||
| 362 | Cons ole.WriteL ine("\nDo you want t hese entit y records deleted? ( y/n) [y]: "); | |||||
| 363 | Stri ng answer = Console. ReadLine() ; | |||||
| 364 | ||||||
| 365 | dele teRecords = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ) || answe r == Strin g.Empty); | |||||
| 366 | } | |||||
| 367 | ||||||
| 368 | if (dele teRecords) | |||||
| 369 | { | |||||
| 370 | _ser viceProxy. Delete(Sav edQueryVis ualization .EntityLog icalName, | |||||
| 371 | _orgOwnedV isualizati onId); | |||||
| 372 | _ser viceProxy. Delete("ac count", _a ccountId); | |||||
| 373 | Cons ole.WriteL ine("Entit y records have been deleted.") ; | |||||
| 374 | } | |||||
| 375 | } | |||||
| 376 | ||||||
| 377 | ||||||
| 378 | #e ndregion H ow To Samp le Code | |||||
| 379 | ||||||
| 380 | #r egion Main | |||||
| 381 | // / <summary > | |||||
| 382 | // / Main. Ru ns the sam ple and pr ovides err or output. | |||||
| 383 | // / <param n ame="args" >Array of arguments to Main me thod.</par am> | |||||
| 384 | // / </summar y> | |||||
| 385 | st atic publi c void Mai n(string[] args) | |||||
| 386 | { | |||||
| 387 | try | |||||
| 388 | { | |||||
| 389 | // O btain the target org anization' s Web addr ess and cl ient logon | |||||
| 390 | // c redentials from the user. | |||||
| 391 | Serv erConnecti on serverC onnect = n ew ServerC onnection( ); | |||||
| 392 | Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on(); | |||||
| 393 | ||||||
| 394 | CRUD Visualizat ion app = new CRUDVi sualizatio n(); | |||||
| 395 | app. Run(config , true); | |||||
| 396 | ||||||
| 397 | ||||||
| 398 | } | |||||
| 399 | catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex ) | |||||
| 400 | { | |||||
| 401 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 402 | Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p); | |||||
| 403 | Cons ole.WriteL ine("Code: {0}", ex. Detail.Err orCode); | |||||
| 404 | Cons ole.WriteL ine("Messa ge: {0}", ex.Detail. Message); | |||||
| 405 | Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text); | |||||
| 406 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 407 | null == ex .Detail.In nerFault ? "No Inner Fault" : "Has Inner Fault"); | |||||
| 408 | } | |||||
| 409 | catch (S ystem.Time outExcepti on ex) | |||||
| 410 | { | |||||
| 411 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 412 | Cons ole.WriteL ine("Messa ge: {0}", ex.Message ); | |||||
| 413 | Cons ole.WriteL ine("Stack Trace: {0 }", ex.Sta ckTrace); | |||||
| 414 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 415 | null == ex .InnerExce ption.Mess age ? "No Inner Faul t" : ex.In nerExcepti on.Message ); | |||||
| 416 | } | |||||
| 417 | catch (S ystem.Exce ption ex) | |||||
| 418 | { | |||||
| 419 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 420 | Cons ole.WriteL ine(ex.Mes sage); | |||||
| 421 | ||||||
| 422 | // D isplay the details o f the inne r exceptio n. | |||||
| 423 | if ( ex.InnerEx ception != null) | |||||
| 424 | { | |||||
| 425 | Console.Wr iteLine(ex .InnerExce ption.Mess age); | |||||
| 426 | ||||||
| 427 | FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e | |||||
| 428 | = ex.I nnerExcept ion | |||||
| 429 | as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>; | |||||
| 430 | if (fe != null) | |||||
| 431 | { | |||||
| 432 | Consol e.WriteLin e("Timesta mp: {0}", fe.Detail. Timestamp) ; | |||||
| 433 | Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code); | |||||
| 434 | Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage); | |||||
| 435 | Consol e.WriteLin e("Plugin Trace: {0} ", fe.Deta il.TraceTe xt); | |||||
| 436 | Consol e.WriteLin e("Inner F ault: {0}" , | |||||
| 437 | nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault"); | |||||
| 438 | } | |||||
| 439 | } | |||||
| 440 | } | |||||
| 441 | // Addit ional exce ptions to catch: Sec urityToken Validation Exception, ExpiredSe curityToke nException , | |||||
| 442 | // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion. | |||||
| 443 | ||||||
| 444 | finally | |||||
| 445 | { | |||||
| 446 | Cons ole.WriteL ine("Press <Enter> t o exit."); | |||||
| 447 | Cons ole.ReadLi ne(); | |||||
| 448 | } | |||||
| 449 | ||||||
| 450 | } | |||||
| 451 | #e ndregion M ain | |||||
| 452 | } | |||||
| 453 | } | |||||
| 454 | //</snippe tCRUDVisua lization> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.