169. Araxis Merge File Comparison Report

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

169.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\Activities SendEmail.cs Tue Dec 20 19:51:44 2016 UTC
2 Wed Feb 1 19:56:22 2017 UTC

169.2 Comparison summary

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

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

169.4 Active regular expressions

No regular expressions were active.

169.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 SendEmail>        
18   using Syst em;        
19   using Syst em.Service Model;        
20   using Syst em.Service Model.Desc ription;        
21   using Syst em.Text;        
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   using Micr osoft.Xrm. Sdk.Client ;        
30          
31          
32   // This na mespace is  found in  Microsoft. Crm.Sdk.Pr oxy.dll as sembly        
33   // found i n the SDK\ bin folder .        
34   using Micr osoft.Crm. Sdk.Messag es;        
35          
36   namespace  Microsoft. Crm.Sdk.Sa mples        
37   {        
38       public  class Sen dEmail        
39       {        
40           #r egion Clas s Level Me mbers        
41           //  Define th e IDs need ed for thi s sample.        
42           pr ivate Guid  _emailId;        
43           pr ivate Guid  _contactI d;        
44           pr ivate Guid  _userId;        
45           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
46          
47           #e ndregion C lass Level  Members        
48          
49           #r egion How  To Sample  Code        
50           // / <summary >        
51           // / Send an  e-mail mes sage.        
52           // / </summar y>        
53           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
54           // / <param n ame="promp tforDelete ">When Tru e, the use r will be  prompted t o delete a ll        
55           // / created  entities.< /param>        
56           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt forDelete)        
57           {        
58                try        
59                {        
60                    // C onnect to  the Organi zation ser vice.         
61                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
62                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,server Config.Cre dentials,  serverConf ig.DeviceC redentials ))        
63                    {        
64                         // This st atement is  required  to enable  early-boun d type sup port.        
65                         _servicePr oxy.Enable ProxyTypes ();        
66          
67                         // Call th e method t o create a ny data th at this sa mple requi res.        
68                         CreateRequ iredRecord s();        
69          
70                         //<snippet SendEmail1 >        
71          
72                         // Use the  SendEmail  message t o send an  e-mail mes sage.        
73                         SendEmailR equest sen dEmailreq  = new Send EmailReque st        
74                         {        
75                             EmailI d = _email Id,        
76                             Tracki ngToken =  "",        
77                             IssueS end = true        
78                         };        
79          
80                         SendEmailR esponse se ndEmailres p = (SendE mailRespon se)_servic eProxy.Exe cute(sendE mailreq);        
81                         Console.Wr iteLine("S ent the e- mail messa ge.");                       
82          
83                         //</snippe tSendEmail 1>        
84          
85                         DeleteRequ iredRecord s(promptfo rDelete);        
86                    }        
87                }        
88          
89                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
90                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
91                {        
92                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
93                    thro w;        
94                }        
95           }        
96          
97           // / <summary >        
98           // / This met hod create s any enti ty records  that this  sample re quires.                 
99           // / </summar y>        
100           pu blic void  CreateRequ iredRecord s()        
101           {        
102                // Creat e a contac t to send  an email t o (To: fie ld)        
103                Contact  emailConta ct = new C ontact        
104                {        
105                    Firs tName = "N ancy",        
106                    Last Name = "An derson",        
107                    EMai lAddress1  = "nancy@c ontoso.com "        
108                };        
109                _contact Id = _serv iceProxy.C reate(emai lContact);        
110                Console. WriteLine( "Created a  contact:  {0}.", ema ilContact. FirstName  + " " + em ailContact .LastName) ;        
111          
112                // Get a  system us er to send  the email  (From: fi eld)        
113                WhoAmIRe quest syst emUserRequ est = new  WhoAmIRequ est();        
114                WhoAmIRe sponse sys temUserRes ponse = (W hoAmIRespo nse)_servi ceProxy.Ex ecute(syst emUserRequ est);        
115                _userId  = systemUs erResponse .UserId;        
116          
117                // Creat e the 'Fro m:' activi ty party f or the ema il        
118                Activity Party from Party = ne w Activity Party        
119                {        
120                    Part yId = new  EntityRefe rence(Syst emUser.Ent ityLogical Name, _use rId)        
121                };        
122          
123                // Creat e the 'To: ' activity  party for  the email        
124                Activity Party toPa rty = new  ActivityPa rty        
125                {        
126                    Part yId = new  EntityRefe rence(Cont act.Entity LogicalNam e, _contac tId)        
127                };        
128                Console. WriteLine( "Created a ctivity pa rties.");        
129          
130                // Creat e an e-mai l message.        
131                Email em ail = new  Email        
132                {        
133                    To =  new Activ ityParty[]  { toParty  },        
134                    From  = new Act ivityParty [] { fromP arty },        
135                    Subj ect = "SDK  Sample e- mail",        
136                    Desc ription =  "SDK Sampl e for Send Email Mess age.",        
137                    Dire ctionCode  = true        
138                };        
139                _emailId  = _servic eProxy.Cre ate(email) ;        
140                Console. WriteLine( "Create {0 }.", email .Subject);        
141           }        
142          
143          
144           // / <summary >        
145           // / Deletes  the custom  entity re cord that  was create d for this  sample.        
146           // / <param n ame="promp t">Indicat es whether  to prompt  the user         
147           // / to delet e the enti ty created  in this s ample.</pa ram>        
148           // / </summar y>        
149           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
150           {        
151                bool toB eDeleted =  true;        
152          
153                if (prom pt)        
154                {        
155                    // A sk the use r if the c reated ent ities shou ld be dele ted.        
156                    Cons ole.Write( "\nDo you  want these  entity re cords dele ted? (y/n)  [y]: ");        
157                    Stri ng answer  = Console. ReadLine() ;        
158                    if ( answer.Sta rtsWith("y ") ||        
159                         answer.Sta rtsWith("Y ") ||        
160                         answer ==  String.Emp ty)        
161                    {        
162                         toBeDelete d = true;        
163                    }        
164                    else        
165                    {        
166                         toBeDelete d = false;        
167                    }        
168                }        
169          
170                if (toBe Deleted)        
171                {        
172                    _ser viceProxy. Delete(Ema il.EntityL ogicalName , _emailId );        
173                    _ser viceProxy. Delete(Con tact.Entit yLogicalNa me, _conta ctId); ;        
174          
175                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
176                }        
177           }        
178          
179           #e ndregion H ow To Samp le Code        
180          
181           #r egion Main  method        
182           // / <summary >        
183           // / Main. Ru ns the sam ple and pr ovides err or output.        
184           // / <param n ame="args" >Array of  arguments  to Main me thod.</par am>        
185           // / </summar y>        
186           st atic publi c void Mai n(string[]  args)        
187           {        
188                try        
189                {        
190                    // O btain the  target org anization' s Web addr ess and cl ient logon          
191                    // c redentials  from the  user.        
192                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
193                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
194          
195                    Send Email app  = new Send Email();        
196                    app. Run(config , true);        
197          
198                }        
199                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
200                {        
201                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
202                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
203                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
204                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
205                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
206                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
207                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
208                }        
209                catch (S ystem.Time outExcepti on ex)        
210                {        
211                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
212                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
213                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
214                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
215                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
216                }        
217                catch (S ystem.Exce ption ex)        
218                {        
219                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
220                    Cons ole.WriteL ine(ex.Mes sage);        
221          
222                    // D isplay the  details o f the inne r exceptio n.        
223                    if ( ex.InnerEx ception !=  null)        
224                    {        
225                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
226          
227                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e =        
228                             ex.Inn erExceptio n        
229                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
230                         if (fe !=  null)        
231                         {        
232                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
233                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
234                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
235                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
236                             Consol e.WriteLin e("Inner F ault: {0}" ,        
237                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
238                         }        
239                    }        
240                }        
241                // Addit onal excep tions to c atch: Secu rityTokenV alidationE xception,  ExpiredSec urityToken Exception,        
242                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
243          
244                finally        
245                {        
246                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
247                    Cons ole.ReadLi ne();        
248                }        
249          
250           }        
251           #e ndregion M ain method        
252          
253       }        
254   }        
255   //</snippe tSendEmail >