Produced by Araxis Merge on 2/1/2017 2:56:56 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 | RetrieveVisualizationsAttachedToAnEntity.cs | Tue Dec 20 19:51:43 2016 UTC |
| 2 | Wed Feb 1 19:56:56 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 191 |
| 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 RetrieveVi sualizatio nsAttached ToAnEntity > | |||||
| 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 retriev e organiza tion-owned visualiza tions atta ched to | |||||
| 39 | /// an entity. T his sample specifica lly retrie ves organi zation-own ed visuali zations | |||||
| 40 | /// th at are att ached to t he 'Accoun t' entity. | |||||
| 41 | /// </ summary> | |||||
| 42 | public class Ret rieveVisua lizationsA ttachedToA nEntity | |||||
| 43 | { | |||||
| 44 | #r egion Clas s Level Me mbers | |||||
| 45 | // / <summary > | |||||
| 46 | // / Stores t he organiz ation serv ice proxy. | |||||
| 47 | // / </summar y> | |||||
| 48 | Or ganization ServicePro xy _servic eProxy; | |||||
| 49 | ||||||
| 50 | #e ndregion C lass Level Members | |||||
| 51 | ||||||
| 52 | #r egion How To Sample Code | |||||
| 53 | // / <summary > | |||||
| 54 | // / Create a nd configu re the org anization service pr oxy. | |||||
| 55 | // / Retrieve organizat ion-owned visualizat ions. | |||||
| 56 | // / Optional ly delete any entity records t hat were c reated for this samp le. | |||||
| 57 | // / </summar y> | |||||
| 58 | // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param> | |||||
| 59 | // / <param n ame="promp tforDelete ">When Tru e, the use r will be prompted t o delete a ll | |||||
| 60 | // / created entities.< /param> | |||||
| 61 | ||||||
| 62 | pub lic void R un(ServerC onnection. Configurat ion server Config, bo ol promptF orDelete) | |||||
| 63 | { | |||||
| 64 | try | |||||
| 65 | { | |||||
| 66 | // C onnect to the Organi zation ser vice. | |||||
| 67 | // T he using s tatement a ssures tha t the serv ice proxy will be pr operly dis posed. | |||||
| 68 | 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 )) | |||||
| 69 | { | |||||
| 70 | // This st atement is required to enable early-boun d type sup port. | |||||
| 71 | _servicePr oxy.Enable ProxyTypes (); | |||||
| 72 | ||||||
| 73 | //<snippet RetrieveVi sualizatio nsAttached ToAnEntity 1> | |||||
| 74 | // Create a query fo r retrievi ng all org anization- owned visu alizations | |||||
| 75 | // that ar e attached to the ac count enti ty. | |||||
| 76 | QueryExpre ssion mySa vedQuery = new Query Expression | |||||
| 77 | { | |||||
| 78 | Entity Name = Sav edQueryVis ualization .EntityLog icalName, | |||||
| 79 | Column Set = new ColumnSet( "name"), | |||||
| 80 | Criter ia = new F ilterExpre ssion | |||||
| 81 | { | |||||
| 82 | Co nditions = | |||||
| 83 | { | |||||
| 84 | ne w Conditio nExpressio n | |||||
| 85 | { | |||||
| 86 | Attrib uteName = "primaryen titytypeco de", | |||||
| 87 | Operat or = Condi tionOperat or.Equal, | |||||
| 88 | Values = {Accou nt.EntityL ogicalName } | |||||
| 89 | } | |||||
| 90 | } | |||||
| 91 | } | |||||
| 92 | }; | |||||
| 93 | ||||||
| 94 | // Retriev e a collec tion of or ganization -owned vis ualization s that are attached to the acc ount entit y. | |||||
| 95 | DataCollec tion<Entit y> results = _servic eProxy.Ret rieveMulti ple(mySave dQuery).En tities; | |||||
| 96 | ||||||
| 97 | // Display the names of the re trieved or ganization -owned vis ualization s. | |||||
| 98 | Console.Wr iteLine("R etrieved t he followi ng visuali zations fo r the Acco unt entity :"); | |||||
| 99 | foreach (E ntity enti ty in resu lts) | |||||
| 100 | { | |||||
| 101 | SavedQ ueryVisual ization or gVisualiza tion = (Sa vedQueryVi sualizatio n)entity; | |||||
| 102 | Consol e.WriteLin e("{0}", o rgVisualiz ation.Name ); | |||||
| 103 | } | |||||
| 104 | //</snippe tRetrieveV isualizati onsAttache dToAnEntit y1> | |||||
| 105 | } | |||||
| 106 | } | |||||
| 107 | // Catch any servi ce fault e xceptions that Micro soft Dynam ics CRM th rows. | |||||
| 108 | catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>) | |||||
| 109 | { | |||||
| 110 | // Y ou can han dle an exc eption her e or pass it back to the calli ng method. | |||||
| 111 | thro w; | |||||
| 112 | } | |||||
| 113 | } | |||||
| 114 | ||||||
| 115 | #e ndregion H ow To Samp le Code | |||||
| 116 | ||||||
| 117 | #r egion Main | |||||
| 118 | /// <summary> | |||||
| 119 | /// Main. Run s the samp le and pro vides erro r output. | |||||
| 120 | /// <param na me="args"> Array of a rguments t o Main met hod.</para m> | |||||
| 121 | /// </summary > | |||||
| 122 | sta tic public void Main (string[] args) | |||||
| 123 | { | |||||
| 124 | try | |||||
| 125 | { | |||||
| 126 | // Ob tain the t arget orga nization's Web addre ss and cli ent logon | |||||
| 127 | // cr edentials from the u ser. | |||||
| 128 | Serve rConnectio n serverCo nnect = ne w ServerCo nnection() ; | |||||
| 129 | Serve rConnectio n.Configur ation conf ig = serve rConnect.G etServerCo nfiguratio n(); | |||||
| 130 | ||||||
| 131 | Retri eveVisuali zationsAtt achedToAnE ntity app = new Retr ieveVisual izationsAt tachedToAn Entity(); | |||||
| 132 | app.R un(config, true); | |||||
| 133 | ||||||
| 134 | ||||||
| 135 | } | |||||
| 136 | catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex ) | |||||
| 137 | { | |||||
| 138 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 139 | Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p); | |||||
| 140 | Cons ole.WriteL ine("Code: {0}", ex. Detail.Err orCode); | |||||
| 141 | Cons ole.WriteL ine("Messa ge: {0}", ex.Detail. Message); | |||||
| 142 | Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text); | |||||
| 143 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 144 | null == ex .Detail.In nerFault ? "No Inner Fault" : "Has Inner Fault"); | |||||
| 145 | } | |||||
| 146 | catch (S ystem.Time outExcepti on ex) | |||||
| 147 | { | |||||
| 148 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 149 | Cons ole.WriteL ine("Messa ge: {0}", ex.Message ); | |||||
| 150 | Cons ole.WriteL ine("Stack Trace: {0 }", ex.Sta ckTrace); | |||||
| 151 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 152 | null == ex .InnerExce ption.Mess age ? "No Inner Faul t" : ex.In nerExcepti on.Message ); | |||||
| 153 | } | |||||
| 154 | catch (S ystem.Exce ption ex) | |||||
| 155 | { | |||||
| 156 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 157 | Cons ole.WriteL ine(ex.Mes sage); | |||||
| 158 | ||||||
| 159 | // D isplay the details o f the inne r exceptio n. | |||||
| 160 | if ( ex.InnerEx ception != null) | |||||
| 161 | { | |||||
| 162 | Console.Wr iteLine(ex .InnerExce ption.Mess age); | |||||
| 163 | ||||||
| 164 | FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e | |||||
| 165 | = ex.I nnerExcept ion | |||||
| 166 | as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>; | |||||
| 167 | if (fe != null) | |||||
| 168 | { | |||||
| 169 | Consol e.WriteLin e("Timesta mp: {0}", fe.Detail. Timestamp) ; | |||||
| 170 | Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code); | |||||
| 171 | Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage); | |||||
| 172 | Consol e.WriteLin e("Plugin Trace: {0} ", fe.Deta il.TraceTe xt); | |||||
| 173 | Consol e.WriteLin e("Inner F ault: {0}" , | |||||
| 174 | nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault"); | |||||
| 175 | } | |||||
| 176 | } | |||||
| 177 | } | |||||
| 178 | // Additi onal excep tions to c atch: Secu rityTokenV alidationE xception, ExpiredSec urityToken Exception, | |||||
| 179 | // Securi tyAccessDe niedExcept ion, Messa geSecurity Exception, and Secur ityNegotia tionExcept ion. | |||||
| 180 | ||||||
| 181 | finally | |||||
| 182 | { | |||||
| 183 | Conso le.WriteLi ne("Press <Enter> to exit."); | |||||
| 184 | Cons ole.ReadLi ne(); | |||||
| 185 | } | |||||
| 186 | ||||||
| 187 | } | |||||
| 188 | #e ndregion M ain | |||||
| 189 | } | |||||
| 190 | } | |||||
| 191 | //</snippe tRetrieveV isualizati onsAttache dToAnEntit y> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.