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

654.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\SharePointIntegration CRUDSharePointLocationRecords.cs Tue Dec 20 19:51:45 2016 UTC
2 Wed Feb 1 19:56:55 2017 UTC

654.2 Comparison summary

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

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

654.4 Active regular expressions

No regular expressions were active.

654.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //  This f ile is par t of the M icrosoft D ynamics CR M 2011 SDK  code samp les.        
3   //        
4   //  Copyri ght (C) Mi crosoft Co rporation.   All righ ts reserve d.        
5   //        
6   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
7   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
8   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
9   //        
10   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
11   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
12   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
13   //  PARTIC ULAR PURPO SE.        
14   // ======= ========== ========== ========== ========== ========== ========== ==        
15          
16   //<snippet CRUDShareP ointLocati onRecords>        
17   using Syst em;        
18   using Syst em.Service Model;        
19   using Syst em.Service Model.Desc ription;        
20          
21   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
22   // located  in the SD K\bin fold er of the  SDK downlo ad.        
23   using Micr osoft.Xrm. Sdk;        
24   using Micr osoft.Xrm. Sdk.Query;        
25   using Micr osoft.Xrm. Sdk.Client ;        
26          
27   namespace  Microsoft. Crm.Sdk.Sa mples        
28   {        
29       /// <s ummary>        
30       /// De monstrates  how to cr eate, retr ieve, upda te, and de lete.        
31       /// Sh arePoint l ocation re cords.</su mmary>        
32       /// <r emarks>        
33       /// At  run-time,  you will  be given t he option  to delete  all the        
34       /// da tabase rec ords creat ed by this  program.< /remarks>        
35       public  class CRU DSharePoin tLocationR ecords        
36       {        
37           #r egion Clas s Level Me mbers        
38          
39           pr ivate Guid  _spSiteId ;        
40           pr ivate Guid  _spDocLoc Id;        
41           pr ivate Guid  _account1 Id;        
42           pr ivate Guid  _account2 Id;                 
43           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
44          
45           #e ndregion C lass Level  Members        
46          
47           #r egion How- To Sample  Code        
48           // / <summary >        
49           // / This met hod first  connects t o the Orga nization s ervice. Af terwards,        
50           // / create,  retrieve,  update, an d delete o perations  are perfor med on the          
51           // / SharePoi nt locatio n records.        
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                    //<s nippetCRUD SharePoint LocationRe cords1>        
61                    // C onnect to  the Organi zation ser vice.         
62                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
63                    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 ))        
64                    {        
65                         // This st atement is  required  to enable  early-boun d type sup port.        
66                         _servicePr oxy.Enable ProxyTypes ();        
67          
68                         CreateRequ iredRecord s();        
69                     //< snippetCRU DSharePoin tLocationR ecords2>        
70                         // Instant iate a Sha rePoint si te object.        
71                         // See the  Entity Me tadata top ic in the  SDK docume ntation to  determine          
72                         // which a ttributes  must be se t for each  entity.        
73                         SharePoint Site spSit e = new Sh arePointSi te        
74                         {        
75                             Name =  "Sample S harePoint  Site",        
76                             Descri ption = "S ample Shar ePoint Sit e Location  record",        
77                                     
78                             // TOD O: Change  this URL t o a valid  SharePoint  URL.                                  
79                             Absolu teURL = "h ttp://www. example.co m",        
80                         };        
81          
82                         // Create  a SharePoi nt site re cord named  Sample Sh arePoint S ite.        
83                         _spSiteId  = _service Proxy.Crea te(spSite) ;        
84                         //</snippe tCRUDShare PointLocat ionRecords 2>        
85                         Console.Wr iteLine("{ 0} created .", spSite .Name);        
86                         //<snippet CRUDShareP ointLocati onRecords3 >        
87                         // Instant iate a Sha rePoint do cument loc ation obje ct.        
88                         // See the  Entity Me tadata top ic in the  SDK docume ntation to  determine          
89                         // which a ttributes  must be se t for each  entity.        
90                         SharePoint DocumentLo cation spD ocLoc = ne w SharePoi ntDocument Location        
91                         {        
92                             Name =  "Sample S harePoint  Document L ocation",        
93                             Descri ption = "S ample Shar ePoint Doc ument Loca tion recor d",        
94                                     
95                             // Set  the Sampl e SharePoi nt Site cr eated earl ier as the  parent si te.        
96                             Parent SiteOrLoca tion = new  EntityRef erence(Sha rePointSit e.EntityLo gicalName,  _spSiteId ),        
97                             Relati veUrl = "s pdocloc",        
98          
99                             // Ass ociate thi s document  location  instance w ith the Fo urth Coffe e        
100                             // sam ple accoun t record.        
101                             Regard ingObjectI d = new En tityRefere nce(Accoun t.EntityLo gicalName,  _account1 Id)        
102                         };        
103          
104                         // Create  a SharePoi nt documen t location  record na med Sample  SharePoin t Document  Location.        
105                         _spDocLocI d = _servi ceProxy.Cr eate(spDoc Loc);        
106                         //</snippe tCRUDShare PointLocat ionRecords 3>        
107                         Console.Wr iteLine("{ 0} created .", spDocL oc.Name);        
108          
109                         // Retriev e the Shar ePoint sit e and Shar ePoint doc ument loca tion conta ining seve ral of its  attribute s.        
110                         ColumnSet  colsSpSite  = new Col umnSet("na me", "abso luteurl");        
111                         SharePoint Site retri evedSpSite  = (ShareP ointSite)_ servicePro xy.Retriev e(SharePoi ntSite.Ent ityLogical Name, _spS iteId, col sSpSite);        
112          
113                         ColumnSet  colsSpDocL oc = new C olumnSet(" name", "re gardingobj ectid");        
114                         SharePoint DocumentLo cation ret rievedSpDo cLoc = (Sh arePointDo cumentLoca tion)_serv iceProxy.R etrieve(Sh arePointDo cumentLoca tion.Entit yLogicalNa me, _spDoc LocId, col sSpDocLoc) ;        
115                         Console.Wr ite("Retri eved,");        
116          
117                         // Update  the URL of  the Share Point site .        
118                         // TODO: C hange this  URL to a  valid Shar ePoint URL .        
119                         retrievedS pSite.Abso luteURL =  "http://ww w.example. net";        
120                         _servicePr oxy.Update (retrieved SpSite);        
121          
122                         // Update  the ShareP oint docum ent locati on to asso ciate it w ith the         
123                         // Northwi nd Traders  sample ac count.        
124                         retrievedS pDocLoc.Re gardingObj ectId = ne w EntityRe ference(Ac count.Enti tyLogicalN ame,_accou nt2Id);        
125                         _servicePr oxy.Update (retrieved SpDocLoc);        
126          
127                         Console.Wr iteLine("  and update d the reco rds.");        
128          
129                         DeleteRequ iredRecord s(promptfo rDelete);        
130                    }        
131                    //</ snippetCRU DSharePoin tLocationR ecords1>        
132                }        
133          
134                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
135                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
136                {        
137                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
138                    thro w;        
139                }        
140           }        
141          
142           // / <summary >        
143           // / Creates  any entity  records t hat this s ample requ ires.        
144           // / </summar y>        
145           pu blic void  CreateRequ iredRecord s()        
146           {        
147                // Creat e two acco unt record s        
148                        
149                Account  account1 =  new Accou nt { Name  = "Fourth  Coffee" };                      
150                _account 1Id = _ser viceProxy. Create(acc ount1);        
151          
152                Account  account2 =  new Accou nt { Name  = "Northwi nd Traders " };        
153                _account 2Id = _ser viceProxy. Create(acc ount2);        
154                        
155                Console. WriteLine( "{0} and { 1} sample  accounts c reated.",  account1.N ame, accou nt2.Name);        
156           }        
157          
158           // / <summary >        
159           // / Deletes  any entity  records t hat were c reated for  this samp le.        
160           // / <param n ame="promp t">Indicat es whether  to prompt  the user         
161           // / to delet e the reco rds create d in this  sample.</p aram>        
162           // / </summar y>        
163           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
164           {        
165                bool del eteRecords  = true;        
166          
167                if (prom pt)        
168                {        
169                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n) [y]:  ");        
170                    Stri ng answer  = Console. ReadLine() ;        
171          
172                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ) || answe r == Strin g.Empty);        
173                }        
174          
175                if (dele teRecords)        
176                {        
177                    _ser viceProxy. Delete(Sha rePointDoc umentLocat ion.Entity LogicalNam e, _spDocL ocId);        
178                    _ser viceProxy. Delete(Sha rePointSit e.EntityLo gicalName,  _spSiteId );        
179                    _ser viceProxy. Delete(Acc ount.Entit yLogicalNa me, _accou nt1Id);        
180                    _ser viceProxy. Delete(Acc ount.Entit yLogicalNa me, _accou nt2Id);        
181                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
182                }        
183           }        
184          
185           #e ndregion H ow-To Samp le Code        
186          
187           #r egion Main  method        
188          
189           // / <summary >        
190           // / Standard  Main() me thod used  by most SD K samples.        
191           // / </summar y>        
192           // / <param n ame="args" ></param>        
193           st atic publi c void Mai n(string[]  args)        
194           {        
195                try        
196                {        
197                    // O btain the  target org anization' s Web addr ess and cl ient logon          
198                    // c redentials  from the  user.        
199                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
200                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
201          
202                    CRUD SharePoint LocationRe cords app  = new CRUD SharePoint LocationRe cords();        
203                    app. Run(config , true);        
204                }        
205                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
206                {        
207                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
208                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
209                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
210                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
211                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
212                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
213                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
214                }        
215                catch (S ystem.Time outExcepti on ex)        
216                {        
217                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
218                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
219                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
220                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
221                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
222                }        
223                catch (S ystem.Exce ption ex)        
224                {        
225                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
226                    Cons ole.WriteL ine(ex.Mes sage);        
227          
228                    // D isplay the  details o f the inne r exceptio n.        
229                    if ( ex.InnerEx ception !=  null)        
230                    {        
231                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
232          
233                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
234                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
235                         if (fe !=  null)        
236                         {        
237                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
238                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
239                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
240                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
241                             Consol e.WriteLin e("Inner F ault: {0}" ,        
242                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
243                         }        
244                    }        
245                }        
246                finally        
247                {        
248                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
249                    Cons ole.ReadLi ne();        
250                }        
251           }        
252           #e ndregion M ain method        
253       }        
254   }        
255   //</snippe tCRUDShare PointLocat ionRecords >