458. Araxis Merge File Comparison Report

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

458.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\Attributes DumpPicklistInfo.cs Tue Dec 20 19:51:47 2016 UTC
2 Wed Feb 1 19:56:46 2017 UTC

458.2 Comparison summary

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

458.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

458.4 Active regular expressions

No regular expressions were active.

458.5 Comparison detail

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 DumpPickli stInfo>        
18   using Syst em;        
19   using Syst em.Linq;        
20   using Syst em.Xml.Lin q;        
21   using Syst em.Service Model;        
22   using Syst em.Service Model.Desc ription;        
23   using Syst em.Collect ions.Gener ic;        
24   using Syst em.Xml.Ser ialization ;        
25   using Syst em.Xml;        
26   using Syst em.IO;        
27          
28   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
29   // found i n the SDK\ bin folder .        
30   using Micr osoft.Xrm. Sdk;        
31   using Micr osoft.Xrm. Sdk.Query;        
32   using Micr osoft.Xrm. Sdk.Metada ta;        
33   using Micr osoft.Xrm. Sdk.Client ;        
34   using Micr osoft.Xrm. Sdk.Messag es;        
35          
36   // This na mespace is  found in  Microsoft. Crm.Sdk.Pr oxy.dll as sembly        
37   // found i n the SDK\ bin folder .        
38   using Micr osoft.Crm. Sdk.Messag es;        
39          
40   namespace  Microsoft. Crm.Sdk.Sa mples        
41   {        
42       /// <s ummary>        
43       /// Th is sample  shows how  to retriev e and writ e out all  the option  set value s:        
44       /// pi cklist, st ate and st atus attri bute types .        
45       /// </ summary>        
46       public  class Dum pPicklistI nfo        
47       {        
48           #r egion Clas s Level Me mbers        
49          
50           // / <summary >        
51           // / Stores t he organiz ation serv ice proxy.        
52           // / </summar y>        
53           Or ganization ServicePro xy _servic eProxy;        
54          
55           //  Create st orage for  new attrib utes being  created        
56           pu blic List< AttributeM etadata> a ddedAttrib utes;        
57          
58           //  Specify w hich langu age code t o use in t he sample.  If you ar e using a  language        
59           //  other tha n US Engli sh, you wi ll need to  modify th is value a ccordingly .        
60           //  See http: //msdn.mic rosoft.com /en-us/lib rary/0h88f ahh.aspx        
61           pu blic const  int _lang uageCode =  1033;        
62          
63           //  Define th e IDs/vari ables need ed for thi s sample.        
64           pu blic int _ insertedSt atusValue;        
65          
66           #e ndregion C lass Level  Members        
67          
68           #r egion How  To Sample  Code        
69           // / <summary >        
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           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
75           {        
76                try        
77                {        
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                         //<snippet DumpPickli stInfo1>        
87                         #region Ho w to dump  attribute  info        
88                         //<snippet DumpPickli stInfo2>        
89                         RetrieveAl lEntitiesR equest req uest = new  RetrieveA llEntities Request()        
90                         {        
91                             Entity Filters =  EntityFilt ers.Attrib utes,        
92                             Retrie veAsIfPubl ished = tr ue        
93                         };        
94          
95                         // Retriev e the Meta Data.        
96                         RetrieveAl lEntitiesR esponse re sponse = ( RetrieveAl lEntitiesR esponse)_s erviceProx y.Execute( request);        
97                                
98                         // Create  an instanc e of Strea mWriter to  write tex t to a fil e.        
99                         // The usi ng stateme nt also cl oses the S treamWrite r.        
100                         // To view  this file , right cl ick the fi le and cho ose open w ith Excel.          
101                         // Excel w ill figure  out the s chema and  display th e informat ion in col umns.        
102          
103                         String fil ename = St ring.Conca t("Attribu tePicklist Values.xml ");        
104                         using (Str eamWriter  sw = new S treamWrite r(filename ))        
105                         {        
106                             // Cre ate Xml Wr iter.        
107                             XmlTex tWriter me tadataWrit er = new X mlTextWrit er(sw);        
108          
109                             // Sta rt Xml Fil e.        
110                             metada taWriter.W riteStartD ocument();        
111          
112                             // Met adata Xml  Node.        
113                             metada taWriter.W riteStartE lement("Me tadata");        
114          
115                             foreac h (EntityM etadata cu rrentEntit y in respo nse.Entity Metadata)        
116                             {        
117                                         
118                                 if  (currentE ntity.IsIn tersect.Va lue == fal se)        
119                                 {        
120                                      // Start  Entity No de        
121                                      metadata Writer.Wri teStartEle ment("Enti ty");        
122          
123                                      // Write  the Entit y's Inform ation.        
124                                      metadata Writer.Wri teElementS tring("Ent itySchemaN ame", curr entEntity. SchemaName );        
125                                      if (curr entEntity. IsCustomiz able.Value  == true)        
126                                          meta dataWriter .WriteElem entString( "IsCustomi zable", "y es");        
127                                      else        
128                                          meta dataWriter .WriteElem entString( "IsCustomi zable", "n o");        
129          
130                                      #region  Attributes        
131          
132                                      // Write  Entity's  Attributes .        
133                                      metadata Writer.Wri teStartEle ment("Attr ibutes");        
134          
135                                      foreach  (Attribute Metadata c urrentAttr ibute in c urrentEnti ty.Attribu tes)        
136                                      {        
137                                          // O nly write  out main a ttributes.        
138                                          if ( currentAtt ribute.Att ributeOf = = null)        
139                                          {        
140          
141                                               // Start A ttribute N ode        
142                                               metadataWr iter.Write StartEleme nt("Attrib ute");        
143          
144                                               // Write A ttribute's  informati on.        
145                                               metadataWr iter.Write ElementStr ing("Schem aName", cu rrentAttri bute.Schem aName);        
146                                               metadataWr iter.Write ElementStr ing("Type" , currentA ttribute.A ttributeTy pe.Value.T oString()) ;        
147          
148                                               if (curren tAttribute .GetType()  == typeof (PicklistA ttributeMe tadata))        
149                                               {        
150                                                   Pickli stAttribut eMetadata  optionMeta data = (Pi cklistAttr ibuteMetad ata)curren tAttribute ;        
151                                                   // Wri tes the pi cklist's o ptions        
152                                                   metada taWriter.W riteStartE lement("Op tions");        
153          
154                                                   // Wri tes the at tributes o f each pic klist opti on        
155                                                   for (i nt c = 0;  c < option Metadata.O ptionSet.O ptions.Cou nt; c++)        
156                                                   {        
157                                                       me tadataWrit er.WriteSt artElement ("Option") ;        
158                                                       me tadataWrit er.WriteEl ementStrin g("OptionV alue", opt ionMetadat a.OptionSe t.Options[ c].Value.V alue.ToStr ing());        
159                                                       me tadataWrit er.WriteEl ementStrin g("OptionD escription ", optionM etadata.Op tionSet.Op tions[c].L abel.UserL ocalizedLa bel.Label. ToString() );        
160                                                       me tadataWrit er.WriteEn dElement() ;        
161                                                   }        
162          
163                                                   metada taWriter.W riteEndEle ment();        
164          
165                                               }        
166                                               else if (c urrentAttr ibute.GetT ype() == t ypeof(Stat eAttribute Metadata))        
167                                               {        
168                                                   StateA ttributeMe tadata opt ionMetadat a = (State AttributeM etadata)cu rrentAttri bute;        
169                                                   // Wri tes the pi cklist's o ptions        
170                                                   metada taWriter.W riteStartE lement("Op tions");        
171          
172                                                   // Wri tes the at tributes o f each pic klist opti on        
173                                                   for (i nt c = 0;  c < option Metadata.O ptionSet.O ptions.Cou nt; c++)        
174                                                   {        
175                                                       me tadataWrit er.WriteSt artElement ("Option") ;        
176                                                       me tadataWrit er.WriteEl ementStrin g("OptionV alue", opt ionMetadat a.OptionSe t.Options[ c].Value.V alue.ToStr ing());        
177                                                       me tadataWrit er.WriteEl ementStrin g("OptionD escription ", optionM etadata.Op tionSet.Op tions[c].L abel.UserL ocalizedLa bel.Label. ToString() );        
178                                                       me tadataWrit er.WriteEn dElement() ;        
179                                                   }        
180          
181                                                   metada taWriter.W riteEndEle ment();        
182                                               }        
183                                               else if (c urrentAttr ibute.GetT ype() == t ypeof(Stat usAttribut eMetadata) )        
184                                               {        
185                                                   Status AttributeM etadata op tionMetada ta = (Stat usAttribut eMetadata) currentAtt ribute;        
186                                                   // Wri tes the pi cklist's o ptions        
187                                                   metada taWriter.W riteStartE lement("Op tions");        
188          
189                                                   // Wri tes the at tributes o f each pic klist opti on        
190                                                   for (i nt c = 0;  c < option Metadata.O ptionSet.O ptions.Cou nt; c++)        
191                                                   {        
192                                                       me tadataWrit er.WriteSt artElement ("Option") ;        
193                                                       me tadataWrit er.WriteEl ementStrin g("OptionV alue", opt ionMetadat a.OptionSe t.Options[ c].Value.V alue.ToStr ing());        
194                                                       me tadataWrit er.WriteEl ementStrin g("OptionD escription ", optionM etadata.Op tionSet.Op tions[c].L abel.UserL ocalizedLa bel.Label. ToString() );        
195                                                       if  (optionMe tadata.Opt ionSet.Opt ions[c] is  StatusOpt ionMetadat a)        
196                                                            metadata Writer.Wri teElementS tring("Rel atedToStat e", ((Stat usOptionMe tadata)opt ionMetadat a.OptionSe t.Options[ c]).State. ToString() );        
197                                                       me tadataWrit er.WriteEn dElement() ;        
198                                                   }        
199          
200                                                   metada taWriter.W riteEndEle ment();        
201                                               }        
202          
203                                               // End Att ribute Nod e        
204                                               metadataWr iter.Write EndElement ();        
205                                          }        
206                                      }        
207                                      // End A ttributes  Node        
208                                      metadata Writer.Wri teEndEleme nt();        
209          
210                                      #endregi on        
211          
212                                      // End E ntity Node        
213                                      metadata Writer.Wri teEndEleme nt();        
214                                 }        
215                             }        
216          
217                             // End  Metadata  Xml Node        
218                             metada taWriter.W riteEndEle ment();        
219                             metada taWriter.W riteEndDoc ument();        
220          
221                             // Clo se xml wri ter.        
222                             metada taWriter.C lose();        
223                         }        
224          
225                         //</snippe tDumpPickl istInfo2>        
226                         #endregion  How to du mp attribu te info        
227          
228          
229          
230                       C onsole.Wri teLine("Do ne.");        
231                         //</snippe tDumpPickl istInfo1>        
232          
233                         //DeleteRe quiredReco rds(prompt ForDelete) ;        
234                    }        
235                }        
236          
237                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
238                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
239                {        
240                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
241                    thro w;        
242                }        
243           }        
244          
245           // / <summary >        
246           // / Deletes/ Reverts th e record t hat was cr eated/chan ged for th is sample.        
247           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete         
248           // / the reco rds create d in this  sample.</p aram>        
249           // / </summar y>        
250           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
251           {        
252                bool del eteRecords  = true;        
253          
254                if (prom pt)        
255                {        
256                    Cons ole.WriteL ine(        
257                         "\nDo you  want these  entity re cords to b e deleted?  (y/n)");        
258                    Stri ng answer  = Console. ReadLine() ;        
259          
260                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ));        
261                }        
262          
263                if (dele teRecords)        
264                {        
265            
266                }        
267           }        
268           #e ndregion H ow To Samp le Code        
269          
270           #r egion Main        
271           // / <summary >        
272           // / Standard  Main() me thod used  by most SD K samples.        
273           // / </summar y>        
274           // / <param n ame="args" ></param>        
275           st atic publi c void Mai n(string[]  args)        
276           {        
277                try        
278                {        
279                    // O btain the  target org anization' s Web addr ess and cl ient logon          
280                    // c redentials  from the  user.        
281                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
282                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
283          
284                    Dump PicklistIn fo app = n ew DumpPic klistInfo( );        
285                    app. Run(config , false);        
286                }        
287                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
288                {        
289                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
290                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
291                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
292                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
293                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
294                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
295                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
296                }        
297                catch (S ystem.Time outExcepti on ex)        
298                {        
299                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
300                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
301                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
302                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
303                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
304                }        
305                catch (S ystem.Exce ption ex)        
306                {        
307                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
308                    Cons ole.WriteL ine(ex.Mes sage);        
309          
310                    // D isplay the  details o f the inne r exceptio n.        
311                    if ( ex.InnerEx ception !=  null)        
312                    {        
313                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
314          
315                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e        
316                             = ex.I nnerExcept ion        
317                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
318                         if (fe !=  null)        
319                         {        
320                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
321                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
322                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
323                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
324                             Consol e.WriteLin e("Inner F ault: {0}" ,        
325                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
326                         }        
327                    }        
328                }        
329                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
330                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
331          
332                finally        
333                {        
334                            
335                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
336                    Cons ole.ReadLi ne();        
337                }        
338          
339           }        
340           #e ndregion M ain        
341          
342       }        
343   }        
344   //</snippe tDumpPickl istInfo>