487. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2/1/2017 2:56:48 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.

487.1 Files compared

# 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\Metadata\OptionSets CreateOptionSet.cs Tue Dec 20 19:51:47 2016 UTC
2 Wed Feb 1 19:56:48 2017 UTC

487.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 0 0
Removed 1 233

487.3 Comparison options

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

487.4 Active regular expressions

No regular expressions were active.

487.5 Comparison detail

1          
2   // ======= ========== ========== ========== ========== ========== ========== ==        
3   //        
4   //  This f ile is par t of the M icrosoft D ynamics CR M SDK code  samples.        
5   //        
6   //  Copyri ght (C) Mi crosoft Co rporation.   All righ ts reserve d.        
7   //        
8   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
9   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
10   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
11   //        
12   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
13   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
14   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
15   //  PARTIC ULAR PURPO SE.        
16   //        
17   // ======= ========== ========== ========== ========== ========== ========== ==        
18   //<snippet CreateOpti onSet>        
19   using Syst em;        
20   using Syst em.Collect ions.Gener ic;        
21   using Syst em.Linq;        
22   using Syst em.Service Model;        
23   using Syst em.Service Model.Desc ription;        
24          
25   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
26   // found i n the SDK\ bin folder .        
27   using Micr osoft.Xrm. Sdk;        
28   using Micr osoft.Xrm. Sdk.Client ;        
29   using Micr osoft.Xrm. Sdk.Metada ta;        
30   using Micr osoft.Xrm. Sdk.Query;        
31   using Micr osoft.Xrm. Sdk.Discov ery;        
32   using Micr osoft.Xrm. Sdk.Messag es;        
33          
34   namespace  Microsoft. Crm.Sdk.Sa mples        
35   {        
36          
37       /// <s ummary>        
38       /// De monstrates  how to cr eate an op tion set i n CRM.        
39       /// </ summary>        
40       public  class Cre ateOptionS et        
41       {        
42           #r egion Clas s Level Me mbers        
43          
44           // / <summary >        
45           // / Stores t he organiz ation serv ice proxy.        
46           // / </summar y>        
47           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
48          
49          
50           //  Specify w hich langu age code t o use in t he sample.  If you ar e using a  language        
51           //  other tha n US Engli sh, you wi ll need to  modify th is value a ccordingly .        
52           //  See http: //msdn.mic rosoft.com /en-us/lib rary/0h88f ahh.aspx        
53           pr ivate cons t int _lan guageCode  = 1033;        
54          
55           pr ivate cons t String _ optionSetN ame = "new _exampleop tionset";        
56          
57           #e ndregion C lass Level  Members        
58          
59           #r egion How  To Sample  Code        
60           // / <summary >        
61           // / Shows ho w to creat e an Optio n Set.        
62           // / </summar y>        
63           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
64           // / <param n ame="promp tForDelete ">When Tru e, the use r will be  prompted t o delete a ll        
65           // / created  entities.< /param>        
66           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
67           {        
68                try        
69                {        
70          
71                    // C onnect to  the Organi zation ser vice.         
72                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
73                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,        
74                                                                              s erverConfi g.Credenti als, serve rConfig.De viceCreden tials))        
75                    {        
76                         // This st atement is  required  to enable  early-boun d type sup port.        
77                         _servicePr oxy.Enable ProxyTypes ();        
78          
79                         //<snippet CreateOpti onSet1>        
80          
81                         // Define  the option  set to cr eate.        
82                         OptionSetM etadata se tupOptionS etMetadata  = new Opt ionSetMeta data()        
83                         {        
84                             // The  name will  be used t o uniquely  identify  the option  set.        
85                             // Nor mally you  should gen erate this  identifie r using th e publishe r's        
86                             // pre fix and do uble-check  that the  name is no t in use.        
87                             Name =  _optionSe tName,        
88                             Displa yName = ne w Label("E xample Opt ion Set",  _languageC ode),        
89                             Descri ption = ne w Label("A n Example  Option Set ", _langua geCode),        
90                             IsGlob al = true,        
91                             Option SetType =  OptionSetT ype.Pickli st,        
92          
93                             // Def ine the li st of opti ons that p opulate th e option s et        
94                             // The  order her e determin es the ord er shown i n the opti on set.        
95                             Option s =         
96                         {        
97                             // Opt ions accep ts any num ber of Opt ionMetadat a instance s, which        
98                             // are  simply pa irs of Lab els and in teger valu es.        
99                             new Op tionMetada ta(new Lab el("Option  1", _lang uageCode),  null ),        
100                             new Op tionMetada ta(new Lab el("Option  2", _lang uageCode),  null )        
101                         }        
102                         };        
103          
104                         // Wrap th e OptionSe tMetadata  in the app ropriate r equest.        
105                         CreateOpti onSetReque st createO ptionSetRe quest = ne w CreateOp tionSetReq uest        
106                         {        
107                             Option Set = setu pOptionSet Metadata        
108                         };        
109          
110                         // Pass th e execute  statement  to the CRM  service.        
111                         _servicePr oxy.Execut e(createOp tionSetReq uest);        
112                         Console.Wr iteLine("O ption Set  created");        
113          
114                         //</snippe tCreateOpt ionSet1>        
115          
116                         DeleteRequ iredRecord s(promptFo rDelete);        
117                    }        
118                }        
119          
120                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
121                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
122                {        
123                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
124                    thro w;        
125                }        
126           }        
127          
128           // / <summary >        
129           // / Deletes  any entity  records t hat were c reated for  this samp le.        
130           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete  the record s created  in this sa mple.</par am>        
131           // / </summar y>        
132           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
133           {        
134                bool del eteRecords  = true;        
135          
136                if (prom pt)        
137                {        
138                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n)");        
139                    Stri ng answer  = Console. ReadLine() ;        
140          
141                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ));        
142                }        
143          
144                if (dele teRecords)        
145                {        
146          
147                    Dele teOptionSe tRequest d eleteReque st = new D eleteOptio nSetReques t        
148                    {        
149                         Name = _op tionSetNam e        
150                    };        
151                    _ser viceProxy. Execute(de leteReques t);        
152          
153          
154                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
155                }        
156           }        
157                            
158           #e ndregion H ow To Samp le Code        
159          
160           #r egion Main        
161           // / <summary >        
162           // / Standard  Main() me thod used  by most SD K samples.        
163           // / </summar y>        
164           // / <param n ame="args" ></param>        
165           st atic publi c void Mai n(string[]  args)        
166           {        
167                try        
168                {        
169                    // O btain the  target org anization' s Web addr ess and cl ient logon          
170                    // c redentials  from the  user.        
171                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
172                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
173          
174                    Crea teOptionSe t app = ne w CreateOp tionSet();        
175                    app. Run(config , true);        
176                }        
177                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
178                {        
179                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
180                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
181                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
182                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
183                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
184                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
185                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
186                }        
187                catch (S ystem.Time outExcepti on ex)        
188                {        
189                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
190                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
191                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
192                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
193                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
194                }        
195                catch (S ystem.Exce ption ex)        
196                {        
197                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
198                    Cons ole.WriteL ine(ex.Mes sage);        
199          
200                    // D isplay the  details o f the inne r exceptio n.        
201                    if ( ex.InnerEx ception !=  null)        
202                    {        
203                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
204          
205                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
206                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
207                         if (fe !=  null)        
208                         {        
209                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
210                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
211                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
212                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
213                             Consol e.WriteLin e("Inner F ault: {0}" ,        
214                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
215                         }        
216                    }        
217                }        
218                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
219                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
220          
221                finally        
222                {        
223                             
224                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
225                    Cons ole.ReadLi ne();        
226                }        
227          
228           }        
229           #e ndregion M ain        
230          
231       }        
232   }        
233   //</snippe tCreateOpt ionSet>