668. Araxis Merge File Comparison Report

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

668.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\VisualizationsAndDashboards AssignVisualizationToUser.cs Tue Dec 20 19:51:43 2016 UTC
2 Wed Feb 1 19:56:55 2017 UTC

668.2 Comparison summary

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

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

668.4 Active regular expressions

No regular expressions were active.

668.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 AssignVisu alizationT oUser>        
18   using Syst em;        
19   using Syst em.Linq;        
20   using Syst em.Service Model;        
21   using Syst em.Service Model.Desc ription;        
22          
23   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
24   // found i n the SDK\ bin folder .        
25   using Syst em.Xml.Lin q;        
26   using Micr osoft.Xrm. Sdk;        
27   using Micr osoft.Xrm. Sdk.Query;        
28   using Micr osoft.Xrm. Sdk.Discov ery;        
29   using Micr osoft.Xrm. Sdk.Client ;        
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   using Syst em.Directo ryServices ;        
36   using Syst em.Threadi ng;        
37          
38   namespace  Microsoft. Crm.Sdk.Sa mples        
39   {        
40       public  class Ass ignVisuali zationToUs er        
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           //  Define th e IDs need ed for thi s sample.        
50           pr ivate Guid  _userOwne dVisualiza tionId;        
51           pr ivate Guid  _accountI d;        
52           pr ivate Guid [] _opport unitiyIds;        
53           pr ivate Guid  _otherUse rId;        
54          
55           #e ndregion C lass Level  Members        
56          
57           #r egion How  To Sample  Code        
58          
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          
63          pub lic void R un(ServerC onnection. Configurat ion server Config, bo ol promptF orDelete)        
64           {        
65                try        
66                {        
67                    // C onnect to  the Organi zation ser vice.         
68                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
69                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,        
70                                                                              s erverConfi g.Credenti als, serve rConfig.De viceCreden tials))        
71                    {        
72                         // This st atement is  required  to enable  early-boun d type sup port.        
73                         _servicePr oxy.Enable ProxyTypes ();        
74          
75                         // Call th e method t o create a ny data th at this sa mple requi res.        
76                         CreateRequ iredRecord s();        
77          
78                         //<snippet AssignVisu alizationT oUser1>        
79          
80                         AssignRequ est assign Request =  new Assign Request        
81                         {        
82                             Assign ee = new E ntityRefer ence        
83                             {        
84                                 Lo gicalName  = SystemUs er.EntityL ogicalName ,        
85                                 //  Here we c ould assig n the visu alization  to the new ly created  user        
86                                 Id  = _otherU serId        
87                             },        
88          
89                             Target  = new Ent ityReferen ce        
90                             {        
91                                 Lo gicalName  = UserQuer yVisualiza tion.Entit yLogicalNa me,        
92                                 Id  = _userOw nedVisuali zationId        
93                             }        
94                         };        
95                         _servicePr oxy.Execut e(assignRe quest);        
96          
97                         Console.Wr iteLine("T he user vi sualizatio n has been  assigned  to Kevin C ook.");        
98                                
99                         //</snippe tAssignVis ualization ToUser1>        
100          
101                         DeleteRequ iredRecord s(promptFo rDelete);        
102                    }        
103                }        
104          
105                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
106                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
107                {        
108                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
109                    thro w;        
110                }        
111           }        
112          
113           // / <summary >        
114           // / This met hod create s any enti ty records  that this  sample re quires.        
115           // / Creates  the visual ization.        
116           // / </summar y>        
117           pu blic void  CreateRequ iredRecord s()        
118           {        
119                // Creat e a sample  account        
120                Account  setupAccou nt = new A ccount { N ame = "Sam ple Accoun t" };        
121                _account Id = _serv iceProxy.C reate(setu pAccount);        
122                Console. WriteLine( "Created { 0}.", setu pAccount.N ame);        
123          
124                // Creat e some opp otunity re cords for  the visual ization        
125                Opportun ity[] setu pOpportuni ties = new  Opportuni ty[]        
126                    {        
127                         new Opport unity        
128                         {        
129                             Name =  "Sample O pp 01",        
130                             Estima tedValue =  new Money (120000.00 m),        
131                             Actual Value = ne w Money(10 0000.00m),        
132                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
133                                 _a ccountId),        
134                             StepNa me = "Open "        
135                         },        
136                         new Opport unity        
137                         {        
138                             Name =  "Sample O pp 02",        
139                             Estima tedValue =  new Money (240000.00 m),        
140                             Actual Value = ne w Money(20 0000.00m),        
141                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
142                                 _a ccountId),        
143                             StepNa me = "Open "        
144                         },        
145                         new Opport unity        
146                         {        
147                             Name =  "Sample O pp 03",        
148                             Estima tedValue =  new Money (360000.00 m),        
149                             Actual Value = ne w Money(30 0000.00m),        
150                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
151                                 _a ccountId),        
152                             StepNa me = "Open "        
153                         },        
154                         new Opport unity        
155                         {        
156                             Name =  "Sample O pp 04",        
157                             Estima tedValue =  new Money (500000.00 m),        
158                             Actual Value = ne w Money(50 0000.00m),        
159                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
160                                 _a ccountId),        
161                             StepNa me = "Open "        
162                         },        
163                         new Opport unity        
164                         {        
165                             Name =  "Sample O pp 05",        
166                             Estima tedValue =  new Money (110000.00 m),        
167                             Actual Value = ne w Money(60 000.00m),        
168                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
169                                 _a ccountId),        
170                             StepNa me = "Open "        
171                         },        
172                         new Opport unity        
173                         {        
174                             Name =  "Sample O pp 06",        
175                             Estima tedValue =  new Money (90000.00m ),        
176                             Actual Value = ne w Money(70 000.00m),        
177                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
178                                 _a ccountId),        
179                             StepNa me = "Open "        
180                         },        
181                         new Opport unity        
182                         {        
183                             Name =  "Sample O pp 07",        
184                             Estima tedValue =  new Money (620000.00 m),        
185                             Actual Value = ne w Money(48 0000.00m),        
186                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
187                                 _a ccountId),        
188                             StepNa me = "Open "        
189                         },        
190                         new Opport unity        
191                         {        
192                             Name =  "Sample O pp 08",        
193                             Estima tedValue =  new Money (440000.00 m),        
194                             Actual Value = ne w Money(40 0000.00m),        
195                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
196                                 _a ccountId),        
197                             StepNa me = "Open "        
198                         },        
199                         new Opport unity        
200                         {        
201                             Name =  "Sample O pp 09",        
202                             Estima tedValue =  new Money (410000.00 m),        
203                             Actual Value = ne w Money(40 0000.00m),        
204                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
205                                 _a ccountId),        
206                             StepNa me = "Open "        
207                         },        
208                         new Opport unity        
209                         {        
210                             Name =  "Sample O pp 10",        
211                             Estima tedValue =  new Money (650000.00 m),        
212                             Actual Value = ne w Money(65 0000.00m),        
213                             Custom erId = new  EntityRef erence(Acc ount.Entit yLogicalNa me,         
214                                 _a ccountId),        
215                             StepNa me = "Open "        
216                         }                              
217                    };        
218          
219                _opportu nitiyIds =  (from opp  in setupO pportuniti es        
220                                      select _ servicePro xy.Create( opp)).ToAr ray();        
221          
222                Console. WriteLine( "Created f ew opportu nity recor ds for {0} .", setupA ccount.Nam e);        
223          
224                // Creat e a visual ization        
225          
226                // Set T he present ation XML  string.        
227                string p resentatio nXml = @"        
228                         <Chart Pal ette='Brig htPastel'>        
229                             <Serie s>        
230                                 <S eries _Tem plate_='Al l' ShadowO ffset='2'         
231                                      BorderCo lor='64, 6 4, 64' Bor derDashSty le='Solid'        
232                                      BorderWi dth='1' Is ValueShown AsLabel='t rue'         
233                                      Font='Ta homa, 6.75 pt, GdiCha rSet=0'         
234                                      LabelFor eColor='10 0, 100, 10 0'        
235                                      CustomPr operties=' FunnelLabe lStyle=Out side'         
236                                      ChartTyp e='Funnel' >        
237                                      <SmartLa belStyle E nabled='Tr ue' />        
238                                      <Points  />        
239                                 </ Series>        
240                              </Ser ies>        
241                             <Chart Areas>        
242                                 <C hartArea _ Template_= 'All' Back Color='Tra nsparent'        
243                                      BorderCo lor='Trans parent'         
244                                      BorderDa shStyle='S olid'>        
245                                      <Area3DS tyle Enabl e3D='True'          
246                                          IsCl ustered='T rue'/>        
247                                 </ ChartArea>        
248                             </Char tAreas>        
249                             <Legen ds>        
250                                 <L egend _Tem plate_='Al l' Alignme nt='Center        
251                                      LegendSt yle='Table ' Docking= 'Bottom'         
252                                      IsEquall ySpacedIte ms='True'  BackColor= 'White'        
253                                      BorderCo lor='228,  228, 228'  BorderWidt h='0'         
254                                      Font='Ta homa, 8pt,  GdiCharSe t=0'         
255                                      ShadowCo lor='0, 0,  0, 0'         
256                                      ForeColo r='100, 10 0, 100'>        
257                                 </ Legend>        
258                             </Lege nds>        
259                             <Title s>        
260                                 <T itle _Temp late_='All '        
261                                      Font='Ta homa, 9pt,  style=Bol d, GdiChar Set=0'        
262                                      ForeColo r='102, 10 2, 102'>        
263                                 </ Title>        
264                             </Titl es>        
265                             <Borde rSkin Page Color='Con trol'        
266                                 Ba ckColor='C ornflowerB lue'        
267                                 Ba ckSecondar yColor='Co rnflowerBl ue' />        
268                         </Chart>        
269                         ";        
270          
271                // Set t he data XM L string.        
272                string d ataXml = @ "        
273                         <datadefin ition>        
274                             <fetch collection >        
275                                 <f etch mappi ng='logica l' count=' 10'         
276                                      aggregat e='true'>        
277                                      <entity  name='oppo rtunity'>        
278                                          <att ribute nam e='actualv alue_base'          
279                                               aggregate= 'sum'         
280                                               alias='sum _actualval ue_base' / >        
281                                          <att ribute nam e='stepnam e' groupby ='true'         
282                                               alias='ste pname' />        
283                                          <ord er alias=' stepname'  descending ='false'/>        
284                                      </entity >        
285                                 </ fetch>        
286                             </fetc hcollectio n>        
287                             <categ orycollect ion>        
288                                 <c ategory>        
289                                      <measure collection >        
290                                          <mea sure alias ='sum_actu alvalue_ba se'/>        
291                                      </measur ecollectio n>        
292                                 </ category>        
293                             </cate gorycollec tion>        
294                         </datadefi nition>        
295                         ";        
296          
297                // Creat e the visu alization  entity ins tance.        
298                UserQuer yVisualiza tion newUs erOwnedVis ualization  = new Use rQueryVisu alization        
299                {        
300                    Name  = "Sample  User Visu alization" ,        
301                    Desc ription =  "Sample us er-owned v isualizati on.",        
302                    Pres entationDe scription  = presenta tionXml,        
303                    Data Descriptio n = dataXm l,        
304                    Prim aryEntityT ypeCode =  Opportunit y.EntityLo gicalName,                          
305                };        
306                _userOwn edVisualiz ationId =  _servicePr oxy.Create (newUserOw nedVisuali zation);                       
307          
308                Console. WriteLine( "Created { 0}.", newU serOwnedVi sualizatio n.Name);        
309          
310                // Creat e another  user to wh om the vis ualization  will be a ssigned.        
311                _otherUs erId = Sys temUserPro vider.Retr ieveSalesM anager(_se rviceProxy );                   
312                        
313           }        
314          
315           // / <summary >        
316           // / Deletes  the entity  record th at was cre ated for t his sample .        
317           // / <param n ame="promp t">Indicat es whether  to prompt  the user         
318           // / to delet e the enti ty created  in this s ample.</pa ram>        
319           // / </summar y>        
320           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
321           {        
322                bool del eteRecords  = true;        
323          
324                if (prom pt)        
325                {        
326                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n)");        
327                    Stri ng answer  = Console. ReadLine() ;        
328          
329                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ));        
330                }        
331          
332                if (dele teRecords)        
333                {        
334                    // D elete acti on doesn't  work on t he UserQue ryVisualiz ation inst ance if it  is assign ed        
335                    // t o a user o ther than  current us er.        
336                    // S o as a wor karound, w e are impe rsonating  the actual  owner of         
337                    // t he UserQue ryVisualiz ation inst ance to co mplete the  delete ac tion.        
338                    // T o imperson ate anothe r user, se t the Orga nizationSe rviceProxy .CallerId        
339                    // p roperty to  the ID of  the other  user.        
340                    _ser viceProxy. CallerId =  _otherUse rId;        
341                                                  
342                    _ser viceProxy. Delete(Use rQueryVisu alization. EntityLogi calName, _ userOwnedV isualizati onId);                       
343                    _ser viceProxy. Delete(Acc ount.Entit yLogicalNa me, _accou ntId);        
344                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
345                }        
346           }        
347          
348           #e ndregion H ow To Samp le Code        
349          
350           #r egion Main        
351           // / <summary >        
352           // / Main. Ru ns the sam ple and pr ovides err or output.        
353           // / <param n ame="args" >Array of  arguments  to Main me thod.</par am>        
354           // / </summar y>        
355           st atic publi c void Mai n(string[]  args)        
356           {        
357                try        
358                {        
359                    // O btain the  target org anization' s Web addr ess and cl ient logon          
360                    // c redentials  from the  user.        
361                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
362                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
363          
364                    Assi gnVisualiz ationToUse r app = ne w AssignVi sualizatio nToUser();        
365                    app. Run(config , true);        
366          
367          
368                }        
369                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
370                {        
371                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
372                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
373                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
374                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
375                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
376                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
377                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
378                }        
379                catch (S ystem.Time outExcepti on ex)        
380                {        
381                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
382                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
383                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
384                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
385                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
386                }        
387                catch (S ystem.Exce ption ex)        
388                {        
389                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
390                    Cons ole.WriteL ine(ex.Mes sage);        
391          
392                    // D isplay the  details o f the inne r exceptio n.        
393                    if ( ex.InnerEx ception !=  null)        
394                    {        
395                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
396          
397                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e =        
398                             ex.Inn erExceptio n        
399                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
400                         if (fe !=  null)        
401                         {        
402                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
403                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
404                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
405                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
406                             Consol e.WriteLin e("Inner F ault: {0}" ,        
407                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
408                         }        
409                    }        
410                }        
411                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
412                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
413          
414                finally        
415                {        
416                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
417                    Cons ole.ReadLi ne();        
418                }        
419          
420           }        
421           #e ndregion M ain        
422          
423       }        
424   }        
425   //</snippe tAssignVis ualization ToUser>