325. Araxis Merge File Comparison Report

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

325.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\Customizations\Views\WorkWithViews WorkWithViews.cs Tue Dec 20 19:51:42 2016 UTC
2 Wed Feb 1 19:56:30 2017 UTC

325.2 Comparison summary

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

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

325.4 Active regular expressions

No regular expressions were active.

325.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 WorkWithVi ews>        
18   using Syst em;        
19   using Syst em.Service Model;        
20   using Syst em.Service Model.Desc ription;        
21          
22   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
23   // found i n the SDK\ bin folder .        
24   using Micr osoft.Xrm. Sdk;        
25   using Micr osoft.Xrm. Sdk.Client ;        
26   using Micr osoft.Xrm. Sdk.Query;        
27   using Micr osoft.Xrm. Sdk.Discov ery;        
28   using Micr osoft.Xrm. Sdk.Messag es;        
29   using Micr osoft.Xrm. Sdk.Metada ta;        
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       public  class Wor kWithViews        
38       {        
39           #r egion Clas s Level Me mbers        
40           // / <summary >        
41           // / Stores t he organiz ation serv ice proxy.        
42           // / </summar y>        
43           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
44          
45           // private co nst String  _customEn tityName =  "new_bank account";        
46           pr ivate Guid  _customVi ewId;        
47           pr ivate Guid  _deactiva tedViewId;        
48           pr ivate Save dQueryStat e _viewOri ginalState ;        
49           pr ivate Opti onSetValue  _viewOrig inalStatus ;        
50          
51           #e ndregion C lass Level  Members        
52          
53           #r egion How  To Sample  Code        
54           // / <summary >        
55           // / Create a  view.        
56           // / Retrieve  Views        
57           // / Deactiva te a view        
58           // / </summar y>        
59           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
60           // / <param n ame="promp tForDelete ">When Tru e, the use r will be  prompted t o delete a ll        
61           // / created  entities.< /param>        
62           // / <param n ame="promp tForReacti vate">When  True, the  user will  be prompt ed to reac tivate        
63           // / a view t hat was de activated. </param>        
64           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete,  bool prom ptForReact ivate)        
65           {        
66                try        
67                {        
68          
69                    // C onnect to  the Organi zation ser vice.         
70                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
71                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri, serve rConfig.Cr edentials,  serverCon fig.Device Credential s))        
72                    {        
73                         // This st atement is  required  to enable  early-boun d type sup port.        
74                         _servicePr oxy.Enable ProxyTypes ();        
75          
76                         // Create  the view.        
77                         //<snippet WorkWithVi ews1>        
78                         System.Str ing layout Xml =        
79   @"<grid na me='result set' objec t='3' jump ='name' se lect='1'         
80       previe w='1' icon ='1'>        
81       <row n ame='resul t' id='opp ortunityid '>        
82       <cell  name='name ' width='1 50' />         
83       <cell  name='cust omerid' wi dth='150'  />         
84       <cell  name='esti matedclose date' widt h='150' />          
85       <cell  name='esti matedvalue ' width='1 50' />         
86       <cell  name='clos eprobabili ty' width= '150' />         
87       <cell  name='oppo rtunityrat ingcode' w idth='150'  />         
88       <cell  name='oppo rtunitycus tomeridcon tactcontac tid.emaila ddress1'         
89           wi dth='150'  disableSor ting='1' /        
90       </row>        
91   </grid>";        
92          
93                         System.Str ing fetchX ml =        
94                         @"<fetch v ersion='1. 0' output- format='xm l-platform        
95       mappin g='logical ' distinct ='false'>        
96       <entit y name='op portunity' >        
97       <order  attribute ='estimate dvalue' de scending=' false' />         
98       <filte r type='an d'>        
99           <c ondition a ttribute=' statecode'  operator= 'eq'         
100           va lue='0' />          
101       </filt er>        
102       <attri bute name= 'name' />         
103       <attri bute name= 'estimated value' />         
104       <attri bute name= 'estimated closedate'  />         
105       <attri bute name= 'customeri d' />         
106       <attri bute name= 'opportuni tyratingco de' />         
107       <attri bute name= 'closeprob ability' /        
108       <link- entity ali as='opport unitycusto meridconta ctcontacti d'         
109           na me='contac t' from='c ontactid'  to='custom erid'         
110           li nk-type='o uter' visi ble='false '>        
111           <a ttribute n ame='email address1'  />         
112       </link -entity>        
113       <attri bute name= 'opportuni tyid' />         
114       </enti ty>        
115   </fetch>";        
116          
117                         SavedQuery  sq = new  SavedQuery        
118                         {        
119                             Name =  "A New Cu stom Publi c View",        
120                             Descri ption = "A  Saved Que ry created  in code",        
121                             Return edTypeCode  = "opport unity",        
122                             FetchX ml = fetch Xml,        
123                             Layout Xml = layo utXml,        
124                             QueryT ype = 0        
125                         };        
126                                
127                         _customVie wId = _ser viceProxy. Create(sq) ;        
128                         Console.Wr iteLine("A  new view  with the n ame {0} wa s created. ", sq.Name );        
129                         //</snippe tWorkWithV iews1>        
130          
131                                
132                         // Retriev e Views        
133                         //<snippet WorkWithVi ews2>        
134                         QueryExpre ssion mySa vedQuery =  new Query Expression        
135                         {        
136                             Column Set = new  ColumnSet( "savedquer yid", "nam e", "query type", "is default",  "returnedt ypecode",  "isquickfi ndquery"),        
137                             Entity Name = Sav edQuery.En tityLogica lName,        
138                             Criter ia = new F ilterExpre ssion        
139                             {        
140                                 Co nditions =        
141                {        
142                    new  ConditionE xpression        
143                    {        
144                         AttributeN ame = "que rytype",        
145                         Operator =  Condition Operator.E qual,        
146                         Values = { 0}        
147                    },        
148                    new  ConditionE xpression        
149                    {        
150                         AttributeN ame = "ret urnedtypec ode",        
151                         Operator =  Condition Operator.E qual,        
152                         Values = { Opportunit y.EntityTy peCode}        
153                    }        
154                }        
155                             }        
156                         };        
157                         RetrieveMu ltipleRequ est retrie veSavedQue riesReques t = new Re trieveMult ipleReques t { Query  = mySavedQ uery };        
158          
159                         RetrieveMu ltipleResp onse retri eveSavedQu eriesRespo nse = (Ret rieveMulti pleRespons e)_service Proxy.Exec ute(retrie veSavedQue riesReques t);        
160          
161                         DataCollec tion<Entit y> savedQu eries = re trieveSave dQueriesRe sponse.Ent ityCollect ion.Entiti es;        
162          
163                         //Display  the Retrie ved views        
164                         foreach (E ntity ent  in savedQu eries)        
165                         {        
166                             SavedQ uery rsq =  (SavedQue ry)ent;        
167                             Consol e.WriteLin e("{0} : { 1} : {2} :  {3} : {4}  : {5},",  rsq.SavedQ ueryId, rs q.Name, rs q.QueryTyp e, rsq.IsD efault, rs q.Returned TypeCode,  rsq.IsQuic kFindQuery );        
168                         }        
169                         //</snippe tWorkWithV iews2>        
170          
171                         // Deactiv ate a view        
172                         //<snippet WorkWithVi ews3>        
173                         System.Str ing SavedQ ueryName =  "Closed O pportuniti es in Curr ent Fiscal  Year";        
174                         QueryExpre ssion Clos edOpportun itiesViewQ uery = new  QueryExpr ession        
175                         {        
176                             Column Set = new  ColumnSet( "savedquer yid", "sta tecode", " statuscode "),        
177                             Entity Name = Sav edQuery.En tityLogica lName,        
178                             Criter ia = new F ilterExpre ssion        
179                             {        
180                                 Co nditions =        
181                                 {        
182                                      new Cond itionExpre ssion        
183                                      {        
184                                          Attr ibuteName  = "queryty pe",        
185                                          Oper ator = Con ditionOper ator.Equal ,        
186                                          Valu es = {0}        
187                                      },        
188                                      new Cond itionExpre ssion        
189                                      {        
190                                          Attr ibuteName  = "returne dtypecode" ,        
191                                          Oper ator = Con ditionOper ator.Equal ,        
192                                          Valu es = {Oppo rtunity.En tityTypeCo de}        
193                                      },        
194                                                       ne w Conditio nExpressio n        
195                                      {        
196                                          Attr ibuteName  = "name",        
197                                          Oper ator = Con ditionOper ator.Equal ,        
198                                          Valu es = {Save dQueryName }        
199                                      }        
200                                 }        
201                             }        
202                         };        
203          
204                         RetrieveMu ltipleRequ est retrie veOpportun tiesViewRe quest = ne w Retrieve MultipleRe quest { Qu ery = Clos edOpportun itiesViewQ uery };        
205          
206                         RetrieveMu ltipleResp onse retri eveOpportu ntiesViewR esponse =  (RetrieveM ultipleRes ponse)_ser viceProxy. Execute(re trieveOppo rtuntiesVi ewRequest) ;        
207          
208                         SavedQuery  Opportuni tyView = ( SavedQuery )retrieveO pportuntie sViewRespo nse.Entity Collection .Entities[ 0];        
209                         _viewOrigi nalState =  (SavedQue ryState)Op portunityV iew.StateC ode;        
210                         _viewOrigi nalStatus  = Opportun ityView.St atusCode;        
211                                
212          
213                         SetStateRe quest ssre q = new Se tStateRequ est        
214                         {        
215                             Entity Moniker =  new Entity Reference( SavedQuery .EntityLog icalName,  (Guid)Oppo rtunityVie w.SavedQue ryId),        
216                             State  = new Opti onSetValue ((int)Save dQueryStat e.Inactive ),        
217                             Status  = new Opt ionSetValu e(2)        
218                         };        
219                         _servicePr oxy.Execut e(ssreq);        
220                         //</snippe tWorkWithV iews3>        
221                         _deactivat edViewId =  (Guid)Opp ortunityVi ew.SavedQu eryId;        
222          
223          
224                         DeleteRequ iredRecord s(promptFo rDelete);        
225                         Reactivate Deactivate dView(prom ptForReact ivate);        
226                    }        
227                }        
228          
229                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
230                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
231                {        
232                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
233                    thro w;        
234                }        
235           }        
236          
237           // / <summary >        
238           // / Deletes  the custom  view that  was creat ed for thi s sample.        
239           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete  the record s created  in this sa mple.</par am>        
240           // / </summar y>        
241           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
242           {        
243                bool del eteView =  true;        
244          
245                if (prom pt)        
246                {        
247                    Cons ole.WriteL ine("\nDo  you want t his custom  view dele ted? (y/n) ");        
248                    Stri ng answer  = Console. ReadLine() ;        
249          
250                    dele teView = ( answer.Sta rtsWith("y ") || answ er.StartsW ith("Y"));        
251                }        
252          
253                if (dele teView)        
254                {        
255                    _ser viceProxy. Delete(Sav edQuery.En tityLogica lName, _cu stomViewId );        
256                    Cons ole.WriteL ine("The v iew has be en deleted .");        
257                }        
258           }        
259           // / <summary >        
260           // / Reactiva tes the vi ew that wa s deactiva ted for th is sample.        
261           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to reactiv ate the vi ew deactiv ated in th is sample. </param>        
262           // / </summar y>        
263           pu blic void  Reactivate Deactivate dView(bool  prompt)        
264           {        
265                bool rea ctivateVie w = true;        
266          
267                if (prom pt)        
268                {        
269                    Cons ole.WriteL ine("\nDo  you want t o reactiva te the \"C losed Oppo rtunities  in Current  Fiscal Ye ar\" view?  (y/n)");        
270                    Stri ng answer  = Console. ReadLine() ;        
271          
272                    reac tivateView  = (answer .StartsWit h("y") ||  answer.Sta rtsWith("Y "));        
273                }        
274          
275                if (reac tivateView )        
276                {        
277                    SetS tateReques t reactiva teViewRequ est = new  SetStateRe quest        
278                    {        
279                         EntityMoni ker = new  EntityRefe rence(Save dQuery.Ent ityLogical Name, _dea ctivatedVi ewId),        
280                         State = ne w OptionSe tValue((in t)_viewOri ginalState ),        
281                         Status = _ viewOrigin alStatus        
282                    };        
283                    _ser viceProxy. Execute(re activateVi ewRequest) ;        
284                    Cons ole.WriteL ine("The v iew has be en reactiv ated.");        
285                }        
286           }        
287          
288           #e ndregion H ow To Samp le Code        
289          
290           #r egion Main        
291           // / <summary >        
292           // / Slightly  modified  Main() met hod used b y most SDK  samples.        
293           // / </summar y>        
294           // / <param n ame="args" ></param>        
295           st atic publi c void Mai n(string[]  args)        
296           {        
297                try        
298                {        
299                    // O btain the  target org anization' s Web addr ess and cl ient logon          
300                    // c redentials  from the  user.        
301                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
302                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
303          
304                    Work WithViews  app = new  WorkWithVi ews();        
305                    // T he Run met hod has an  additiona l paramete r to promp t for reac tivation o f a view.        
306                    app. Run(config , true, tr ue);        
307                }        
308                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
309                {        
310                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
311                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
312                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
313                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
314                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
315                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
316                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
317                }        
318                catch (S ystem.Time outExcepti on ex)        
319                {        
320                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
321                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
322                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
323                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
324                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
325                }        
326                catch (S ystem.Exce ption ex)        
327                {        
328                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
329                    Cons ole.WriteL ine(ex.Mes sage);        
330          
331                    // D isplay the  details o f the inne r exceptio n.        
332                    if ( ex.InnerEx ception !=  null)        
333                    {        
334                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
335          
336                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
337                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
338                         if (fe !=  null)        
339                         {        
340                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
341                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
342                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
343                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
344                             Consol e.WriteLin e("Inner F ault: {0}" ,        
345                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
346                         }        
347                    }        
348                }        
349                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
350                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
351          
352                finally        
353                {        
354          
355                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
356                    Cons ole.ReadLi ne();        
357                }        
358          
359           }        
360           #e ndregion M ain        
361       }        
362   }        
363   //</snippe tWorkWithV iews>