204. Araxis Merge File Comparison Report

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

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

204.2 Comparison summary

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

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

204.4 Active regular expressions

No regular expressions were active.

204.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 RemoveQueu eItemWorke r>        
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.Query;        
27   using Micr osoft.Xrm. Sdk.Discov ery;        
28          
29   // This na mespace is  found in  Microsoft. Crm.Sdk.Pr oxy.dll as sembly        
30   // found i n the SDK\ bin folder .        
31   using Micr osoft.Crm. Sdk.Messag es;        
32   using Micr osoft.Xrm. Sdk.Client ;        
33          
34   namespace  Microsoft. Crm.Sdk.Sa mples        
35   {        
36       /// <s ummary>        
37       /// Th is sample  shows how  to release  queued ob ject from  worker's q ueue.        
38       /// </ summary>        
39       public  class Rem oveQueueIt emWorker        
40       {        
41           #r egion Clas s Level Me mbers        
42          
43          
44           //  Define th e IDs need ed for thi s sample.        
45           pr ivate Guid  _queueIte mId;        
46           pr ivate Guid  _letterId ;        
47           pr ivate Guid  _queueId;        
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  method to  create an y entity r ecords tha t this sam ple requir es.        
56           // / Remove w orker from  queue ite m to relea se queued  object        
57           // / which us er is work ing on.        
58           // / Optional ly delete  any entity  records t hat were c reated for  this samp le.        
59           // / <para na me="organi zationFrie ndlyName"> The friend ly name of  the         
60           // / target o rganizatio n.</para>        
61           // / <para na me="discov eryServer" >The name  of the dis covery ser ver.</para >        
62           // / <param n ame="promp tForDelete ">Indicate s whether  to prompt  the user t o delete        
63           // / the reco rds create d in this  sample.</p aram>        
64           // / </summar y>        
65           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
66           {        
67                try        
68                {        
69          
70          
71                    // C onnect to  the Organi zation ser vice.         
72                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
73                    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))        
74                    {        
75                         // This st atement is  required  to enable  early-boun d type sup port.        
76                         _servicePr oxy.Enable ProxyTypes ();        
77          
78                         CreateRequ iredRecord s();        
79          
80                         //<snippet RemoveQueu eItemWorke r1>        
81                         // Remove  worker fro m queue it em to rele ase queued  object        
82                         // from wo rker's que ue using R eleaseToQu eueRequest        
83          
84                         ReleaseToQ ueueReques t releaseT oQueueRequ est = new  ReleaseToQ ueueReques t        
85                         {        
86                             QueueI temId = _q ueueItemId        
87                         };        
88                         _servicePr oxy.Execut e(releaseT oQueueRequ est);        
89          
90                         Console.Wr iteLine("R eleased th e queued o bject from  worker qu eue.");        
91                         //</snippe tRemoveQue ueItemWork er1>                           
92          
93                         DeleteRequ iredRecord s(promptFo rDelete);        
94          
95                    }        
96                }        
97                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
98                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
99                {        
100                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
101                    thro w;        
102                }        
103           }        
104          
105           // / <summary >        
106           // / This met hod create s any enti ty records  that this  sample re quires.        
107           // / Create a  queue rec ord.        
108           // / Create a  letter re cord.        
109           // / Create a  queue ite m for queu e record.        
110           // / Retrieve s new owne r's detail s.         
111           // / Update t he queue i tem record  to assign  it to new  owner.        
112           // / </summar y>        
113           pu blic void  CreateRequ iredRecord s()        
114           {        
115                // Creat e a privat e queue in stance and  set its p roperty va lues.        
116                Queue ne wQueue = n ew Queue        
117                {        
118                    Name  = "Exampl e Queue.",        
119                    Desc ription =  "This is a n example  queue.",        
120                    Queu eViewType  = new Opti onSetValue ((int)Queu eQueueView Type.Priva te)        
121                };        
122          
123                // Creat e a new qu eue and st ore its re turned GUI D in a var iable         
124                // for l ater use.        
125                _queueId  = _servic eProxy.Cre ate(newQue ue);        
126          
127                Console. WriteLine( "Created { 0}.", newQ ueue.Name) ;        
128          
129                Letter n ewLetter =  new Lette r        
130                {        
131                    Desc ription =  "Example L etter"        
132                };        
133          
134                _letterI d = _servi ceProxy.Cr eate(newLe tter);        
135          
136                Console. WriteLine( "Created { 0}.", newL etter.Desc ription);        
137          
138                // Creat e a new in stance of  a queueite m and init ialize its          
139                // prope rties.        
140                QueueIte m item = n ew QueueIt em        
141                {        
142                    Queu eId = new  EntityRefe rence(Queu e.EntityLo gicalName,  _queueId) ,        
143                    Obje ctId = new  EntityRef erence(Let ter.Entity LogicalNam e, _letter Id)        
144                };        
145          
146                // Creat e the queu eitem on t he server,  which wil l associat        
147                // the l etter with  the queue .        
148                _queueIt emId = _se rviceProxy .Create(it em);        
149          
150                Console. WriteLine( "Created t he letter  queue item  for the q ueue.");        
151          
152                //<snipp etRemoveQu eueItemWor ker2>        
153                // Retri eve the us er informa tion.        
154                WhoAmIRe quest whoA mIRequest  = new WhoA mIRequest( );        
155                WhoAmIRe sponse who AmIRespons e = (WhoAm IResponse) _servicePr oxy.Execut e(        
156                    whoA mIRequest) ;        
157          
158                ColumnSe t columnSe t = new Co lumnSet("f ullname");        
159                SystemUs er current User = (Sy stemUser)_ servicePro xy.Retriev e(        
160                    Syst emUser.Ent ityLogical Name,        
161                    whoA mIResponse .UserId, c olumnSet);        
162                String c urrentUser Name = cur rentUser.F ullName;        
163                //</snip petRemoveQ ueueItemWo rker2>        
164          
165                // Creat e an insta nce of an  existing q ueueitem i n order to  specify         
166                // the u ser that w ill be wor king on it .        
167                QueueIte m queueIte m = new Qu eueItem        
168                {        
169                    Queu eItemId =  _queueItem Id,        
170                    Work erId = new  EntityRef erence(Sys temUser.En tityLogica lName,        
171                         whoAmIResp onse.UserI d)        
172                };        
173          
174                _service Proxy.Upda te(queueIt em);        
175          
176                Console. WriteLine( "The lette r queue it em is queu ed for new  owner {0} .",        
177                    curr entUserNam e);        
178          
179                return;        
180           }        
181          
182           // / <summary >        
183           // / Deletes  any entity  records t hat were c reated for  this samp le.        
184           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to         
185           // / delete t he records  created i n this sam ple.</para m>        
186           // / </summar y>        
187           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
188           {        
189                bool del eteRecords  = true;        
190          
191                if (prom pt)        
192                {        
193                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n)");        
194                    Stri ng answer  = Console. ReadLine() ;        
195          
196                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ));        
197                }        
198          
199                if (dele teRecords)        
200                {        
201                    _ser viceProxy. Delete(Que ueItem.Ent ityLogical Name, _que ueItemId);        
202                    _ser viceProxy. Delete(Let ter.Entity LogicalNam e, _letter Id);        
203                    _ser viceProxy. Delete(Que ue.EntityL ogicalName , _queueId );        
204          
205                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
206                }        
207           }        
208          
209           #e ndregion H ow To Samp le Code        
210          
211           #r egion Main        
212           // / <summary >        
213           // / Main. Ru ns the sam ple and pr ovides err or output.        
214           // / <param n ame="args" >Array of  arguments  to Main me thod.</par am>        
215           // / </summar y>        
216           st atic publi c void Mai n(string[]  args)        
217           {        
218                try        
219                {        
220                    // O btain the  target org anization' s Web addr ess and cl ient logon          
221                    // c redentials  from the  user.        
222                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
223                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
224          
225                    Remo veQueueIte mWorker ap p = new Re moveQueueI temWorker( );        
226                    app. Run(config , true);        
227                }        
228          
229                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
230                {        
231                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
232                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
233                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
234                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
235                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
236                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
237                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
238                }        
239                catch (S ystem.Time outExcepti on ex)        
240                {        
241                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
242                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
243                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
244                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
245                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
246                }        
247                catch (S ystem.Exce ption ex)        
248                {        
249                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
250                    Cons ole.WriteL ine(ex.Mes sage);        
251          
252                    // D isplay the  details o f the inne r exceptio n.        
253                    if ( ex.InnerEx ception !=  null)        
254                    {        
255                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
256          
257                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e =        
258                             ex.Inn erExceptio n        
259                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
260                         if (fe !=  null)        
261                         {        
262                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
263                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
264                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
265                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
266                             Consol e.WriteLin e("Inner F ault: {0}" ,        
267                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
268                         }        
269                    }        
270                }        
271                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
272                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
273          
274                finally        
275                {        
276                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
277                    Cons ole.ReadLi ne();        
278                }        
279          
280           }        
281           #e ndregion M ain        
282       }        
283   }        
284   //</snippe tRemoveQue ueItemWork er>