239. Araxis Merge File Comparison Report

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

239.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\BusinessDataModel\ProductCatalog CreateAndPublishProducts.cs Tue Dec 20 19:51:44 2016 UTC
2 Wed Feb 1 19:56:27 2017 UTC

239.2 Comparison summary

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

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

239.4 Active regular expressions

No regular expressions were active.

239.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          
18   //<snippet CreateAndP ublishProd ucts>        
19   using Syst em;        
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.Messag es;        
27   using Micr osoft.Xrm. Sdk.Client ;        
28   using Micr osoft.Xrm. Sdk.Query;        
29   using Micr osoft.Xrm. Sdk.Discov ery;        
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:        
39       /// -  Create a p roduct fam ily, produ ct propert y, and chi ld product s.         
40       /// -  Override a  product p roperty at  a child p roduct lev el.        
41       /// -  Publish th e product  hierarchy.          
42       /// -  Revise a c hild produ ct to over write the  overridden  property.        
43       /// </ summary>        
44       public  class Cre ateAndPubl ishProduct s        
45       {        
46           #r egion Clas s Level Me mbers        
47          
48           // / <summary >        
49           // / Stores t he organiz ation serv ice proxy.        
50           // / </summar y>        
51           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
52          
53           //  Define th e IDs need ed for thi s sample.        
54           pu blic Guid  _unitGroup Id;        
55           pu blic Guid  _product1I d;        
56           pu blic Guid  _product2I d;        
57           pu blic Guid  _productFa milyId;        
58           pu blic Guid  _productPr opertyId;        
59           pu blic Guid  _productOv erridenPro pertyId;        
60           pu blic Guid  _productOv erwrittenP ropertyId;        
61           pu blic Guid  _priceList Id;        
62           pu blic Guid  _priceList Item1Id;        
63           pu blic Guid  _priceList Item2Id;        
64           pu blic Guid  _productRe lationId;        
65           pu blic UoM _ unit;        
66          
67           #e ndregion C lass Level  Members        
68          
69           #r egion How  To Sample  Code        
70           // / <summary >        
71           // / Create a nd configu re the org anization  service pr oxy.        
72           // / Initiate  creating  all entity  records t hat this s ample requ ires.        
73           // / Create a  product f amily with  a product  property  and two ch ild produc t records.        
74           // / Create a  substitut e relation  between t he two pro ducts.        
75           // / Override  the produ ct propert y for one  of the chi ld product s.        
76           // / Publish  the produc t family h ierarchy,  including  the child  records.        
77           // / Revise a  child pro duct to ov erwrite th e overridd en propert y.        
78           // / Publish  the child  product.        
79           // / Optional ly delete  any entity  records t hat were c reated for  this samp le.        
80           // / </summar y>        
81           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
82           // / <param n ame="promp tforDelete ">When Tru e, the use r will be  prompted t o delete a ll        
83           // / created  entities.< /param>        
84           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
85           {        
86                try        
87                {        
88                    // C onnect to  the Organi zation ser vice.         
89                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
90                    usin g (_servic eProxy = S erverConne ction.GetO rganizatio nProxy(ser verConfig) )        
91                    {        
92                         // This st atement is  required  to enable  early-boun d type sup port.        
93                         _servicePr oxy.Enable ProxyTypes ();        
94          
95                         // Call th e method t o create a ny data th at this sa mple requi res.        
96                         CreateRequ iredRecord s();        
97          
98                         //<snippet Createandu blishProdu cts1>        
99                         // Create  a product  family        
100                         Product ne wProductFa mily = new  Product        
101                         {        
102                             Name =  "Example  Product Fa mily",        
103                             Produc tNumber =  "PF001",        
104                             Produc tStructure  = new Opt ionSetValu e(2)        
105                         };        
106                         _productFa milyId = _ servicePro xy.Create( newProduct Family);        
107                         Console.Wr iteLine("\ nCreated ' {0}'", new ProductFam ily.Name);        
108          
109                         // Create  a product  property        
110                         DynamicPro perty newP roperty =  new Dynami cProperty        
111                         {        
112                             Name =  "Example  Property",        
113                             Regard ingObjectI d = new En tityRefere nce(Produc t.EntityLo gicalName,          
114                                                   _produ ctFamilyId ),        
115                             IsRead Only = tru e,        
116                             IsRequ ired = tru e,        
117                             IsHidd en = false ,        
118                             DataTy pe = new O ptionSetVa lue(3), // Single lin e of text        
119                             Defaul tValueStri ng = "Defa ult Value"                                                             
120                         };        
121                         _productPr opertyId =  _serviceP roxy.Creat e(newPrope rty);        
122                         Console.Wr iteLine("\ nCreated ' {0}' for t he product  family",  newPropert y.Name);        
123          
124                         // Create  couple of  product re cords unde r the prod uct family        
125                         Product ne wProduct1  = new Prod uct        
126                         {        
127                             Name =  "Example  Product 1" ,        
128                             Produc tNumber =  "P001",        
129                             Produc tStructure  = new Opt ionSetValu e(1),        
130                             Parent ProductId  = new Enti tyReferenc e(Product. EntityLogi calName, _ productFam ilyId),        
131                             Quanti tyDecimal  = 2,        
132                             Defaul tUoMSchedu leId = new  EntityRef erence(UoM Schedule.E ntityLogic alName, _u nitGroupId ),        
133                             Defaul tUoMId = n ew EntityR eference(U oM.EntityL ogicalName , _unit.Id )        
134                         };        
135                         _product1I d = _servi ceProxy.Cr eate(newPr oduct1);        
136          
137                         Console.Wr iteLine("\ nCreated ' {0}' under  the produ ct family" , newProdu ct1.Name);        
138          
139                         Product ne wProduct2  = new Prod uct        
140                         {        
141                             Name =  "Example  Product 2" ,        
142                             Produc tNumber =  "P002",        
143                             Produc tStructure  = new Opt ionSetValu e(1),        
144                             Parent ProductId  = new Enti tyReferenc e(Product. EntityLogi calName, _ productFam ilyId),        
145                             Quanti tyDecimal  = 2,        
146                             Defaul tUoMSchedu leId = new  EntityRef erence(UoM Schedule.E ntityLogic alName, _u nitGroupId ),        
147                             Defaul tUoMId = n ew EntityR eference(U oM.EntityL ogicalName , _unit.Id )                                  
148                         };        
149                         _product2I d = _servi ceProxy.Cr eate(newPr oduct2);        
150          
151                         Console.Wr iteLine("C reated '{0 }' under t he product  family",  newProduct 2.Name);        
152          
153          
154          
155                         // Create  a price li st items f or the pro ducts        
156                         ProductPri ceLevel ne wPriceList Item1 = ne w ProductP riceLevel        
157                         {        
158                             PriceL evelId = n ew EntityR eference(P riceLevel. EntityLogi calName, _ priceListI d),        
159                             Produc tId = new  EntityRefe rence(Prod uct.Entity LogicalNam e, _produc t1Id),        
160                             UoMId  = new Enti tyReferenc e(UoM.Enti tyLogicalN ame, _unit .Id),        
161                             Amount  = new Mon ey(20)        
162                         };        
163                         _priceList Item1Id =  _servicePr oxy.Create (newPriceL istItem1);        
164          
165                         Console.Wr iteLine("\ nCreated p rice list  for '{0}'" , newProdu ct1.Name);        
166          
167                         ProductPri ceLevel ne wPriceList Item2 = ne w ProductP riceLevel        
168                         {        
169                             PriceL evelId = n ew EntityR eference(P riceLevel. EntityLogi calName, _ priceListI d),        
170                             Produc tId = new  EntityRefe rence(Prod uct.Entity LogicalNam e, _produc t2Id),        
171                             UoMId  = new Enti tyReferenc e(UoM.Enti tyLogicalN ame, _unit .Id),        
172                             Amount  = new Mon ey(20)        
173                         };        
174                         _priceList Item2Id =  _servicePr oxy.Create (newPriceL istItem2);        
175          
176                         Console.Wr iteLine("C reated pri ce list fo r '{0}'",  newProduct 2.Name);        
177          
178                         // Set the  product r elationshi p        
179                         // Set Exa mple Produ ct 1 and E xample Pro duct 2 as  substitute  of each o ther (bi-d irectional )        
180                         ProductSub stitute ne wProductRe lation = n ew Product Substitute        
181                         {        
182                             SalesR elationshi pType = ne w OptionSe tValue(3),        
183                             Direct ion = new  OptionSetV alue(1),        
184                             Produc tId = new  EntityRefe rence(Prod uct.Entity LogicalNam e, _produc t1Id),        
185                             Substi tutedProdu ctId = new  EntityRef erence(Pro duct.Entit yLogicalNa me, _produ ct2Id)        
186                         };        
187                         _productRe lationId =  _serviceP roxy.Creat e(newProdu ctRelation );        
188          
189                         Console.Wr iteLine("\ nCreated a  substitut e relation  between t he two pro ducts.");        
190                         //</snippe tCreateand ublishProd ucts1>        
191          
192                         // Overrid e a produc t property  at the pr oduct leve l        
193                         // In this  case we w ill overri de the pro perty for  'Example P roduct 1'        
194                         DynamicPro perty newO verridePro perty = ne w DynamicP roperty();        
195                         newOverrid eProperty. BaseDynami cPropertyI d = new En tityRefere nce(Dynami cProperty. EntityLogi calName,        
196                                                      _pr oductPrope rtyId);        
197                         newOverrid eProperty. RegardingO bjectId =  new Entity Reference( Product.En tityLogica lName, _pr oduct1Id);        
198                         _productOv erridenPro pertyId =  _servicePr oxy.Create (newOverri deProperty );        
199          
200                         // Retriev e the attr ibutes of  the cloned  property  you want t o update                              
201                         ColumnSet  columns =  new Column Set();        
202                         columns.Ad dColumns(" name", "is readonly",  "isrequir ed");        
203                         DynamicPro perty retr ievedOverr idenProper ty = (Dyna micPropert y)_service Proxy.Retr ieve(        
204                                                      Dyn amicProper ty.EntityL ogicalName , _product OverridenP ropertyId,        
205                                                      col umns);        
206          
207                         // Update  the attrib utes        
208                         retrievedO verridenPr operty.Nam e = "Overr idden Exam ple Proper ty";        
209                         retrievedO verridenPr operty.IsR eadOnly =  true;        
210                         retrievedO verridenPr operty.IsR equired =  false;        
211                         _servicePr oxy.Update (retrieved OverridenP roperty);        
212                         Console.Wr iteLine("\ nOverridde n the prod uct proper ty for 'Ex ample Prod uct 1'.");        
213          
214                         // Prompt  the user w hether to  publish th e product  family and  products        
215                         bool publi shRecords  = true;                            
216                         Console.Wr iteLine("\ nDo you wa nt the pro duct recor ds publish ed? (y/n)" );        
217                         String ans wer = Cons ole.ReadLi ne();        
218                         publishRec ords = (an swer.Start sWith("y")  || answer .StartsWit h("Y"));        
219                                
220                         if (publis hRecords)        
221                         {        
222                             Publis hProductHi erarchyReq uest publi shReq = ne w PublishP roductHier archyReque st        
223                             {        
224                                 Ta rget = new  EntityRef erence(Pro duct.Entit yLogicalNa me, _produ ctFamilyId )        
225                             };        
226                             Publis hProductHi erarchyRes ponse publ ished = (P ublishProd uctHierarc hyResponse )_serviceP roxy.Execu te(publish Req);        
227                             if (pu blished.Re sults != n ull)        
228                             {        
229                                 Co nsole.Writ eLine("Pub lished the  product r ecords");        
230                             }        
231          
232                             // Ove rwrite a p roduct pro perty        
233                             Consol e.WriteLin e("\nRevis ing 'Examp le Product  1' to dem onstrate p roduct pro perty over write.");        
234          
235                             // Ret rieve the  StateCode  of Product  that you  want to re vise                               
236                             Column Set cols =  new Colum nSet();        
237                             cols.A ddColumns( "name", "s tatecode") ;        
238                             Produc t retrieve dPublished Product =  (Product)_ servicePro xy.Retriev e(        
239                                                           Product.E ntityLogic alName, _p roduct1Id,        
240                                                           cols);        
241          
242                             // Upd ate the st ate of the  Product t o "Under R evision"        
243                             retrie vedPublish edProduct. StateCode  = ProductS tate.Under Revision;        
244                             Update Request up dateProper tyState =  new Update Request        
245                             {        
246                                 Ta rget = ret rievedPubl ishedProdu ct        
247                             };        
248                             _servi ceProxy.Ex ecute(upda teProperty State);        
249                             Consol e.WriteLin e("\nChang ed '{0}' t o 'Under R evision' s tate.", re trievedPub lishedProd uct.Name);        
250          
251                             Dynami cProperty  newOverwri teProperty  = new Dyn amicProper ty();        
252                             newOve rwriteProp erty.BaseD ynamicProp ertyId = n ew EntityR eference(D ynamicProp erty.Entit yLogicalNa me,        
253                                                           _productO verridenPr opertyId);        
254                             newOve rwriteProp erty.Regar dingObject Id = new E ntityRefer ence(Produ ct.EntityL ogicalName        
255                                 _p roduct1Id) ;        
256                             _produ ctOverwrit tenPropert yId = _ser viceProxy. Create(new OverwriteP roperty);        
257          
258                             // Ret rieve the  attributes  of the cl oned prope rty you wa nt to upda te        
259                             Column Set myCols  = new Col umnSet();        
260                             myCols .AddColumn s("name",  "isreadonl y", "isreq uired");        
261                             Dynami cProperty  retrievedO verwritten Property =  (DynamicP roperty)_s erviceProx y.Retrieve (        
262                                                           DynamicPr operty.Ent ityLogical Name, _pro ductOverwr ittenPrope rtyId,        
263                                                           myCols);        
264          
265          
266                             // Upd ate the at tributes o f the clon ed propert y to compl ete the ov erwrite         
267                             retrie vedOverwri ttenProper ty.Name =  "Overwritt en Example  Property" ;        
268                             retrie vedOverwri ttenProper ty.IsReadO nly = true ;        
269                             retrie vedOverrid enProperty .IsRequire d = false;        
270                             _servi ceProxy.Up date(retri evedOverwr ittenPrope rty);        
271                             Consol e.WriteLin e("\nOverw ritten the  product p roperty fo r 'Example  Product 1 '.");        
272          
273                             // Ret rieve the  StateCode  of Product  that you  want to pu blish                               
274                             Column Set prodCo ls = new C olumnSet() ;        
275                             prodCo ls.AddColu mns("name" , "stateco de");        
276                             Produc t retrieve dRevisedPr oduct = (P roduct)_se rviceProxy .Retrieve(        
277                                                           Product.E ntityLogic alName, _p roduct1Id,        
278                                                           prodCols) ;        
279          
280                             // Upd ate the st ate of the  Product t o "Active"        
281                             retrie vedRevised Product.St ateCode =  ProductSta te.Active;        
282                             Update Request pu blishProdu ct1 = new  UpdateRequ est        
283                             {        
284                                 Ta rget = ret rievedRevi sedProduct        
285                             };        
286                             _servi ceProxy.Ex ecute(publ ishProduct 1);        
287                             Consol e.WriteLin e("\nPubli shed '{0}' .", retrie vedRevised Product.Na me);        
288                         }        
289          
290                         DeleteRequ iredRecord s(promptFo rDelete);        
291                    }        
292                }        
293                catch        
294                {        
295                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
296                    thro w;        
297                }        
298           }        
299          
300           // / <summary >        
301           // / This met hod create s any enti ty records  that this  sample re quires.        
302           // / Create a  unit grou p and pric e list.        
303           // / </summar y>        
304           pu blic void  CreateRequ iredRecord s()        
305           {        
306                Console. WriteLine( "Creating  required r ecords for  the sampl e");        
307                Console. WriteLine( "********* ********** ********** ********** **");        
308                // Creat e a unit g roup.        
309                UoMSched ule newUni tGroup = n ew UoMSche dule        
310                {        
311                    Name  = "Exampl e Unit Gro up",        
312                    Base UoMName =  "Example P rimary Uni t"        
313                };        
314          
315                _unitGro upId = _se rviceProxy .Create(ne wUnitGroup );        
316          
317                Console. WriteLine( "Created { 0}", newUn itGroup.Na me);        
318          
319                // retri eve the un it id.        
320                QueryExp ression un itQuery =  new QueryE xpression        
321                {        
322                    Enti tyName = U oM.EntityL ogicalName ,        
323                    Colu mnSet = ne w ColumnSe t("uomid",  "name"),        
324                    Crit eria = new  FilterExp ression(),        
325                    Page Info = new  PagingInf o        
326                    {        
327                         PageNumber  = 1,        
328                         Count = 1        
329                    }        
330                };        
331                unitQuer y.Criteria .AddCondit ion("uomsc heduleid",  Condition Operator.E qual, _uni tGroupId);        
332          
333                // Retri eve the un it.        
334                _unit =  (UoM)_serv iceProxy.R etrieveMul tiple(unit Query).Ent ities[0];        
335          
336                Console. WriteLine( "Retrieved  {0}", _un it.Name);        
337          
338          
339                // Creat e a price  list        
340                PriceLev el newPric eList = ne w PriceLev el        
341                {        
342                    Name  = "Exampl e Price Li st"        
343                };        
344                _priceLi stId = _se rviceProxy .Create(ne wPriceList );        
345          
346                Console. WriteLine( "Created { 0}", newPr iceList.Na me);        
347                Console. WriteLine( "********* ********** ********** ********** **");        
348          
349                return;        
350           }        
351          
352           // / <summary >        
353           // / Deletes  any entity  records t hat were c reated for  this samp le.        
354           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete  the record s created  in this sa mple.</par am>        
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)");        
363                    Stri ng answer  = Console. ReadLine() ;        
364                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ));        
365                }        
366          
367                if (dele teRecords)        
368                {                         
369                    Cons ole.WriteL ine("Delet ing entity  records.. . please w ait!");        
370          
371                    _ser viceProxy. Delete(Pro ductSubsti tute.Entit yLogicalNa me, _produ ctRelation Id);        
372                    _ser viceProxy. Delete(Pro ductPriceL evel.Entit yLogicalNa me, _price ListItem1I d);        
373                    _ser viceProxy. Delete(Pro ductPriceL evel.Entit yLogicalNa me, _price ListItem2I d);                         
374                    _ser viceProxy. Delete(Pro duct.Entit yLogicalNa me, _produ ctFamilyId );        
375                    _ser viceProxy. Delete(Pri ceLevel.En tityLogica lName, _pr iceListId) ;        
376                    _ser viceProxy. Delete(UoM Schedule.E ntityLogic alName, _u nitGroupId );        
377          
378                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
379                }        
380           }        
381           #e ndregion H ow To Samp le Code        
382          
383           #r egion Main        
384           // / <summary >        
385           // / Standard  Main() me thod used  by most SD K samples.        
386           // / </summar y>        
387           // / <param n ame="args" ></param>        
388           st atic publi c void Mai n(string[]  args)        
389           {        
390                try        
391                {        
392                    // O btain the  target org anization' s Web addr ess and cl ient logon          
393                    // c redentials  from the  user.        
394                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
395                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
396          
397                    Crea teAndPubli shProducts  app = new  CreateAnd PublishPro ducts();        
398                    app. Run(config , true);        
399                }        
400          
401                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
402                {        
403                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
404                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
405                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
406                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
407                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
408                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
409                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
410                }        
411                catch (S ystem.Time outExcepti on ex)        
412                {        
413                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
414                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
415                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
416                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
417                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
418                }        
419                catch (S ystem.Exce ption ex)        
420                {        
421                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
422                    Cons ole.WriteL ine(ex.Mes sage);        
423          
424                    // D isplay the  details o f the inne r exceptio n.        
425                    if ( ex.InnerEx ception !=  null)        
426                    {        
427                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
428          
429                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
430                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
431                         if (fe !=  null)        
432                         {        
433                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
434                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
435                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
436                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
437                             Consol e.WriteLin e("Inner F ault: {0}" ,        
438                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
439                         }        
440                    }        
441                }        
442                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
443                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
444          
445                finally        
446                {        
447                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
448                    Cons ole.ReadLi ne();        
449                }        
450           }        
451           #e ndregion M ain        
452       }        
453   }        
454   //</snippe tCreateAnd PublishPro ducts>