188. Araxis Merge File Comparison Report

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

188.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\BusinessManagement CleanUpQueueItems.cs Tue Dec 20 19:51:44 2016 UTC
2 Wed Feb 1 19:56:23 2017 UTC

188.2 Comparison summary

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

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

188.4 Active regular expressions

No regular expressions were active.

188.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 CleanUpQue ueItems>        
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 Micr osoft.Xrm. Sdk;        
26   using Micr osoft.Xrm. Sdk.Query;        
27   using Micr osoft.Xrm. Sdk.Discov ery;        
28   using Micr osoft.Xrm. Sdk.Messag es;        
29          
30   // This na mespace is  found in  Microsoft. Crm.Sdk.Pr oxy.dll as sembly        
31   // found i n the SDK\ bin folder .        
32   using Micr osoft.Crm. Sdk.Messag es;        
33   using Micr osoft.Xrm. Sdk.Client ;        
34          
35   namespace  Microsoft. Crm.Sdk.Sa mples        
36   {        
37       /// <s ummary>        
38       /// Th is Sample  shows how  to delete  inactive i tems in a  queue.        
39       /// </ summary>        
40       public  class Cle anUpQueueI tems        
41       {        
42           #r egion Clas s Level Me mbers        
43          
44           //  Define th e IDs need ed for thi s sample.        
45           pr ivate Guid  _queueId;        
46           pr ivate Guid  _phoneCal lId;        
47           pr ivate Guid  _queueIte mId;        
48           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
49          
50           #e ndregion C lass Level  Members        
51          
52           #r egion How  To Sample  Code        
53           // / <summary >        
54           // / Create a nd configu re the org anization  service pr oxy.        
55           // / Initiate  the metho d to creat e any data  that this  sample re quires.        
56           // / Retrieve  all queue items with  inactive  phone call s from a q ueue.        
57           // / Delete a ll inactiv e phone ca ll entity  instances.        
58           // / Optional ly delete  any entity  records t hat were c reated for  this samp le.        
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           // / </summar y>        
63           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
64           {        
65                try        
66                {        
67          
68                    // C onnect to  the Organi zation ser vice.         
69                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
70                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,        
71                                                                              s erverConfi g.Credenti als, serve rConfig.De viceCreden tials))        
72                    {        
73                         // This st atement is  required  to enable  early-boun d type sup port.        
74                         _servicePr oxy.Enable ProxyTypes ();        
75          
76                         CreateRequ iredRecord s();        
77          
78          
79                         //<snippet CleanUpQue ueItems1>        
80                         // Retriev e the queu eitem with  inactive  phone call s from a q ueue                     
81                         RemoveFrom QueueReque st removeF romQueueRe quest = ne w RemoveFr omQueueReq uest        
82                         {        
83                             QueueI temId = _q ueueItemId        
84                         };        
85                         _servicePr oxy.Execut e(removeFr omQueueReq uest);        
86          
87                         //</snippe tCleanUpQu eueItems1>           
88          
89                         Console.Wr iteLine("I nactive ph onecalls h ave been d eleted fro m the queu e.");        
90          
91                         DeleteRequ iredRecord s(promptFo rDelete);        
92          
93                    }        
94                }        
95                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
96                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
97                {        
98                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
99                    thro w;        
100                }        
101           }        
102          
103           // / <summary >        
104           // / This met hod create s any enti ty records  that this  sample re quires.        
105           // / Create a  queue ins tance.         
106           // / Create a  phone cal l activity  instance.        
107           // / Add phon e call ent ity instan ce in to q ueue.        
108           // / Mark pho ne call en tity insta nce status  as comple ted.        
109           // / </summar y>        
110           pu blic void  CreateRequ iredRecord s()        
111           {        
112                // Creat e a queue  instance a nd set its  property  values.        
113                Queue ne wQueue = n ew Queue()        
114                {        
115                    Name  = "Exampl e Queue",        
116                    Desc ription =  "This is a n example  queue.",        
117                    Queu eViewType  = new Opti onSetValue ((int)Queu eQueueView Type.Priva te)        
118                };        
119          
120                _queueId  = _servic eProxy.Cre ate(newQue ue);        
121                Console. WriteLine( "Created { 0}.", newQ ueue.Name) ;        
122          
123                // Creat e a phone  call activ ity instan ce.        
124                PhoneCal l newPhone Call = new  PhoneCall        
125                {        
126                    Desc ription =  "Example P hone Call"        
127                };        
128          
129                _phoneCa llId = _se rviceProxy .Create(ne wPhoneCall );        
130                Console. WriteLine( "Created { 0}.", newP honeCall.D escription );        
131          
132                // Creat e a new in stance of  a queueite m and init ialize its          
133                // prope rties.        
134                QueueIte m item = n ew QueueIt em        
135                {        
136                    Queu eId = new  EntityRefe rence(Queu e.EntityLo gicalName,  _queueId) ,        
137                    Obje ctId = new  EntityRef erence(Pho neCall.Ent ityLogical Name, _pho neCallId)        
138                };        
139          
140                // Creat e the queu eitem on t he server,  which wil l associat        
141                // the p hone call  activity w ith the qu eue.        
142                _queueIt emId = _se rviceProxy .Create(it em);        
143          
144                Console. WriteLine( "Added pho ne call en tity insta nce to {0} ", newQueu e.Name);        
145          
146                // Mark  the phone  call as co mpleted.        
147                SetState Request se tStatePhon eCall = ne w SetState Request        
148                {        
149                    Enti tyMoniker  = new Enti tyReferenc e(PhoneCal l.EntityLo gicalName,        
150                         _phoneCall Id),        
151                    Stat e = new Op tionSetVal ue((int)Ph oneCallSta te.Complet ed),        
152                    Stat us = new O ptionSetVa lue(-1)        
153                };        
154          
155                _service Proxy.Exec ute(setSta tePhoneCal l);        
156                Console. WriteLine( "PhoneCall  entity in stance has  been mark ed as comp leted.");        
157          
158                return;        
159           }        
160          
161           // / <summary >        
162           // / Deletes  any entity  records t hat were c reated for  this samp le.        
163           // / <param n ame="promp t">Indicat es whether  to prompt  the user         
164           // / to delet e the reco rds create d in this  sample.</p aram>        
165           // / </summar y>        
166           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
167           {        
168                bool del eteRecords  = true;        
169          
170                if (prom pt)        
171                {        
172                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n)");        
173                    Stri ng answer  = Console. ReadLine() ;        
174          
175                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ));        
176                }        
177          
178                if (dele teRecords)        
179                {        
180                    _ser viceProxy. Delete(Pho neCall.Ent ityLogical Name, _pho neCallId);        
181                    _ser viceProxy. Delete(Que ue.EntityL ogicalName , _queueId );        
182          
183                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
184                }        
185           }        
186          
187           #e ndregion H ow To Samp le Code        
188          
189           #r egion Main        
190           // / <summary >        
191           // / Main. Ru ns the sam ple and pr ovides err or output.        
192           // / <param n ame="args" >Array of  arguments  to Main me thod.</par am>        
193           // / </summar y>        
194           st atic publi c void Mai n(string[]  args)        
195           {        
196                try        
197                {        
198                    // O btain the  target org anization' s Web addr ess and cl ient logon          
199                    // c redentials  from the  user.        
200                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
201                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
202          
203                    Clea nUpQueueIt ems app =  new CleanU pQueueItem s();        
204                    app. Run(config , true);        
205                }        
206          
207                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
208                {        
209                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
210                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
211                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
212                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
213                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
214                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
215                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
216                }        
217                catch (S ystem.Time outExcepti on ex)        
218                {        
219                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
220                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
221                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
222                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
223                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
224                }        
225                catch (S ystem.Exce ption ex)        
226                {        
227                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
228                    Cons ole.WriteL ine(ex.Mes sage);        
229          
230                    // D isplay the  details o f the inne r exceptio n.        
231                    if ( ex.InnerEx ception !=  null)        
232                    {        
233                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
234          
235                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e        
236                             = ex.I nnerExcept ion        
237                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
238                         if (fe !=  null)        
239                         {        
240                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
241                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
242                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
243                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
244                             Consol e.WriteLin e("Inner F ault: {0}" ,        
245                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
246                         }        
247                    }        
248                }        
249                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
250                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
251          
252          
253                finally        
254                {        
255                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
256                    Cons ole.ReadLi ne();        
257                }        
258          
259           }        
260           #e ndregion M ain        
261       }        
262   }        
263   //</snippe tCleanUpQu eueItems>