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

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

183.2 Comparison summary

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

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

183.4 Active regular expressions

No regular expressions were active.

183.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 AddToQueue >        
19   using Syst em;        
20   using Syst em.Service Model;        
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          
26   // This na mespace is  found in  Microsoft. Crm.Sdk.Pr oxy.dll as sembly        
27   // found i n the SDK\ bin folder .        
28   using Micr osoft.Crm. Sdk.Messag es;        
29   using Micr osoft.Xrm. Sdk.Client ;        
30   using Syst em.Collect ions;        
31   using Syst em.Collect ions.Gener ic;        
32          
33   namespace  Microsoft. Crm.Sdk.Sa mples        
34   {        
35       /// <s ummary>        
36       /// Th is Sample  shows how  to move a  record fro m one queu e to anoth er.        
37       /// </ summary>        
38       public  class Add ToQueue        
39       {        
40           #r egion Clas s Level Me mbers        
41          
42           //  Define th e IDs need ed for thi s sample.        
43           pr ivate Guid  _sourceQu eueId;        
44           pr ivate Guid  _destinat ionQueueId ;        
45           pr ivate Guid  _letterId ;        
46           pr ivate Guid  _userId;        
47           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
48          
49           #e ndregion C lass Level  Members        
50          
51           #r egion How  To Sample  Code        
52           // / <summary >        
53           // / Create a nd configu re the org anization  service pr oxy.        
54           // / Initiate  the metho d to creat e any data  that this  sample re quires.        
55           // / Move a r ecord from  a source  queue to a  destinati on queue.        
56           // / Optional ly delete  any entity  records t hat were c reated for  this samp le.        
57           // / <para na me="organi zationFrie ndlyName"> The friend ly name of  the targe        
58           // / organiza tion.</par a>        
59           // / <para na me="discov eryServer" >The name  of the dis covery ser ver.</para >        
60           // / <param n ame="promp tForDelete ">Indicate s whether  to prompt  the user t        
61           // / delete t he records  created i n this sam ple.</para m>        
62           // / </summar y>        
63           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
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, serve rConfig.Cr edentials,  serverCon fig.Device Credential s))        
70                    {        
71                         // This st atement is  required  to enable  early-boun d type sup port.        
72                         _servicePr oxy.Enable ProxyTypes ();        
73          
74                         CreateRequ iredRecord s();        
75          
76                         Guid Curre ntUserId =  ((WhoAmIR esponse)_s erviceProx y.Execute( new WhoAmI Request()) ).UserId;        
77          
78          
79          
80                         //<snippet RetrieveUs erQueues>        
81                         // Get kno wn private  queues fo r the user          
82                         // by usin g Retrieve UserQueues Request me ssage.        
83                         RetrieveUs erQueuesRe quest retr ieveUserQu euesReques t = new Re trieveUser QueuesRequ est        
84                         {        
85                             UserId  = Current UserId,        
86                             Includ ePublic =  true        
87                         };        
88                         RetrieveUs erQueuesRe sponse ret rieveUserQ ueuesRespo nse =        
89                             (Retri eveUserQue uesRespons e)_service Proxy.Exec ute(retrie veUserQueu esRequest) ;        
90                         EntityColl ection que ues = (Ent ityCollect ion)retrie veUserQueu esResponse .EntityCol lection;        
91          
92                         Guid sourc eQueueId =  new Guid( );        
93                         Guid desti nationQueu eId = new  Guid();        
94          
95                         foreach (E ntity enti ty in queu es.Entitie s)        
96                         {        
97                             Queue  queue = (Q ueue)entit y;        
98                             switch  (queue.Na me)        
99                             {        
100                                 ca se "Source  Queue":        
101                                      sourceQu eueId = qu eue.Id;        
102                                      break;        
103                                 ca se "Destin ation Queu e":        
104                                      destinat ionQueueId  = queue.I d;        
105                                      break;        
106                             }        
107                         }        
108          
109                         //<snippet AddToQueue 1>        
110                         // Move a  record fro m a source  queue to  a destinat ion queue        
111                         // by usin g the AddT oQueue req uest messa ge.        
112                         AddToQueue Request ro uteRequest  = new Add ToQueueReq uest        
113                         {        
114                             Source QueueId =  sourceQueu eId,        
115                             Target  = new Ent ityReferen ce(Letter. EntityLogi calName, _ letterId),        
116                             Destin ationQueue Id = desti nationQueu eId        
117                         };        
118          
119                         // Execute  the Reque st        
120                         _servicePr oxy.Execut e(routeReq uest);        
121                         //</snippe tAddToQueu e1>                                
122          
123                         Console.Wr iteLine(@" The letter  record ha s been mov ed to a ne w queue.") ;        
124          
125                         //</snippe tRetrieveU serQueues>        
126                         DeleteRequ iredRecord s(promptFo rDelete);        
127          
128                    }        
129                }        
130                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
131                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
132                {        
133                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
134                    thro w;        
135                }        
136           }        
137          
138           // / <summary >        
139           // / This met hod create s any enti ty records  that this  sample re quires.        
140           // / Create s ource queu e and dest ination qu eue.        
141           // / Create a  letter  e ntity.        
142           // / Add lett er  entity  to source  queue.        
143           // / </summar y>        
144           pu blic void  CreateRequ iredRecord s()        
145           {        
146                var Queu eViewType  = new        
147                {        
148                    Publ ic = 0,        
149                    Priv ate = 1        
150                };        
151                //Create  new queue s and stor e their re turned GUI Ds in vari ables for  later use.        
152                Queue so urceQueue  = new Queu e        
153                    {        
154                         Name = "So urce Queue ",        
155                         Descriptio n = "This  is an exam ple queue. ",        
156                         QueueViewT ype = new  OptionSetV alue(Queue ViewType.P rivate)        
157                    };        
158          
159                _sourceQ ueueId = _ servicePro xy.Create( sourceQueu e);        
160                Console. WriteLine( "Created { 0}", sourc eQueue.Nam e);        
161          
162                Queue de stinationQ ueue = new  Queue        
163                    {        
164                         Name = "De stination  Queue",        
165                         Descriptio n = "This  is an exam ple queue. ",        
166                         QueueViewT ype = new  OptionSetV alue(Queue ViewType.P rivate)        
167                    };        
168          
169                _destina tionQueueI d = _servi ceProxy.Cr eate(desti nationQueu e);        
170                Console. WriteLine( "Created { 0}", desti nationQueu e.Name);        
171          
172          
173                // Creat e a letter   entity.        
174                Letter n ewLetter =  new Lette r        
175                {        
176                    Desc ription =  "Example L etter"        
177                };        
178          
179                _letterI d = _servi ceProxy.Cr eate(newLe tter);        
180                Console. WriteLine( "Created { 0}", newLe tter.Descr iption);        
181          
182                // Use A ddToQueue  message to  add an  e ntity into  a queue,  which will  associate        
183                // the l etter with  the first  queue.        
184                AddToQue ueRequest  addToSourc eQueue = n ew AddToQu eueRequest        
185                {        
186                    Dest inationQue ueId = _so urceQueueI d,        
187                    Targ et = new E ntityRefer ence(Lette r.EntityLo gicalName,  _letterId )        
188                };        
189          
190                _service Proxy.Exec ute(addToS ourceQueue );        
191                Console. WriteLine( "Added let ter record  to {0}",  sourceQueu e.Name);        
192          
193                // Retri eve/create  a user re cord for a ssigning t he queue i tem to the  user's        
194                // queue .        
195                _userId  = SystemUs erProvider .RetrieveS alesManage r(_service Proxy);        
196          
197                return;        
198           }        
199          
200           // / <summary >        
201           // / Deletes  any entity  records t hat were c reated for  this samp le.        
202           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete         
203           // / the reco rds create d in this  sample.</p aram>        
204           // / </summar y>        
205           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
206           {        
207                bool toB eDeleted =  true;        
208          
209                if (prom pt)        
210                {        
211                    // A sk the use r if the c reated ent ities shou ld be dele ted.        
212                    Cons ole.Write( "\nDo you  want these  entity re cords dele ted? (y/n)  [y]: ");        
213                    Stri ng answer  = Console. ReadLine() ;        
214                    if ( answer.Sta rtsWith("y ") ||        
215                         answer.Sta rtsWith("Y ") ||        
216                         answer ==  String.Emp ty)        
217                    {        
218                         toBeDelete d = true;        
219                    }        
220                    else        
221                    {        
222                         toBeDelete d = false;        
223                    }        
224                }        
225          
226                if (toBe Deleted)        
227                {        
228                    _ser viceProxy. Delete(Let ter.Entity LogicalNam e, _letter Id);        
229                    _ser viceProxy. Delete(Que ue.EntityL ogicalName , _sourceQ ueueId);        
230                    _ser viceProxy. Delete(Que ue.EntityL ogicalName , _destina tionQueueI d);        
231          
232                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
233                }        
234           }        
235          
236           #e ndregion H ow To Samp le Code        
237          
238           #r egion Main        
239           // / <summary >        
240           // / Main. Ru ns the sam ple and pr ovides err or output.        
241           // / <param n ame="args" >Array of  arguments  to Main me thod.</par am>        
242           // / </summar y>        
243           st atic publi c void Mai n(string[]  args)        
244           {        
245                try        
246                {        
247                    // O btain the  target org anization' s Web addr ess and cl ient logon          
248                    // c redentials  from the  user.        
249                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
250                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
251          
252                    AddT oQueue app  = new Add ToQueue();        
253                    app. Run(config , true);        
254                }        
255          
256                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
257                {        
258                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
259                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
260                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
261                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
262                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
263                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
264                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
265                }        
266                catch (S ystem.Time outExcepti on ex)        
267                {        
268                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
269                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
270                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
271                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
272                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
273                }        
274                catch (S ystem.Exce ption ex)        
275                {        
276                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
277                    Cons ole.WriteL ine(ex.Mes sage);        
278          
279                    // D isplay the  details o f the inne r exceptio n.        
280                    if ( ex.InnerEx ception !=  null)        
281                    {        
282                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
283          
284                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e        
285                             = ex.I nnerExcept ion        
286                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
287                         if (fe !=  null)        
288                         {        
289                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
290                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
291                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
292                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
293                             Consol e.WriteLin e("Inner F ault: {0}" ,        
294                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
295                         }        
296                    }        
297                }        
298                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
299                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
300          
301                finally        
302                {        
303                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
304                    Cons ole.ReadLi ne();        
305                }        
306          
307           }        
308           #e ndregion M ain        
309       }        
310   }        
311   //</snippe tAddToQueu e>