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

647.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\Reporting MakeReportAvailableOrUnavailableToOrganization.cs Tue Dec 20 19:51:44 2016 UTC
2 Wed Feb 1 19:56:55 2017 UTC

647.2 Comparison summary

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

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

647.4 Active regular expressions

No regular expressions were active.

647.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 right s reserved .        
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 MakeReport AvailableO rUnavailab leToOrgani zation>        
18   using Syst em;        
19   using Syst em.Service Model;        
20   using Syst em.Service Model.Desc ription;        
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   using Micr osoft.Xrm. Sdk.Client ;        
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          
34   namespace  Microsoft. Crm.Sdk.Sa mples        
35   {        
36       /// <s ummary>        
37       /// Th is sample  shows how  to make a  report ava ilable and          
38       /// un available  to the org anization.        
39       /// </ summary>        
40       public  class Mak eReportAva ilableOrUn availableT oOrganizat ion        
41       {        
42           #r egion Clas s Level Me mbers        
43          
44           // / <summary >        
45           // / Stores t he organiz ation serv ice proxy.        
46           // / </summar y>        
47           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
48          
49           //  Define th e IDs need ed for thi s sample.        
50           pr ivate Guid  _reportId ;        
51          
52           #e ndregion C lass Level  Members        
53          
54           #r egion How  To Sample  Code        
55           // / <summary >        
56           // / Create a nd configu re the org anization  service pr oxy.                 
57           // / Set the  report to  be availab le and the n unavaila ble for th e organiza tion.                 
58           // / Optional ly delete  any entity  records t hat were c reated for  this samp le.        
59           // / </summar y>        
60           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
61           // / <param n ame="promp tforDelete ">When Tru e, the use r will be  prompted t o delete a ll        
62           // / created  entities.< /param>        
63           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt forDelete)        
64           {        
65                try        
66                {        
67                    //<s nippetMake ReportAvai lableOrUna vailableTo Organizati on1>        
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,server Config.Cre dentials,  serverConf ig.DeviceC redentials ))        
71                    {        
72                         // This st atement is  required  to enable  early-boun d type sup port.        
73                         _servicePr oxy.Enable ProxyTypes ();        
74          
75                         // Call th e method t o create a ny data th at this sa mple requi res.        
76                         CreateRequ iredRecord s();        
77          
78                         // Retriev e existing  personal  report.        
79                         Report exi stingPerso nalReport         
80                             (Repor t)_service Proxy.Retr ieve(Repor t.EntityLo gicalName,          
81                             _repor tId,                                   
82                             new Co lumnSet("i spersonal" ));        
83          
84                         // Set IsP ersonal pr operty to  false.         
85                         existingPe rsonalRepo rt.IsPerso nal = fals e;        
86          
87                         // Make th e report a vailable t o the orga nization.        
88                         _servicePr oxy.Update (existingP ersonalRep ort);        
89          
90                         // Retriev e the repo rt and ver ify that t he report  is availab le to the  organizati on        
91                         ColumnSet  Cols1 = ne w ColumnSe t("isperso nal");        
92                         Report ret rieveAvail ableReport  =         
93                             (Repor t)_service Proxy.Retr ieve(Repor t.EntityLo gicalName,          
94                             _repor tId, Cols1 );        
95                         if (retrie veAvailabl eReport.Is Personal.V alue == fa lse)        
96                         {        
97                             Consol e.WriteLin e("Report  is availab le to the  organizati on.");        
98                         }        
99          
100                         // Now mak e the retr ieved repo rt unavail able to th e organiza tion        
101                         retrieveAv ailableRep ort.IsPers onal = tru e;        
102                         _servicePr oxy.Update (retrieveA vailableRe port);        
103                                
104                         // Retriev e the repo rt, and ve rify that  the report  is unavai lable to t he organiz ation        
105                         ColumnSet  Cols2 = ne w ColumnSe t("isperso nal");        
106                         Report ret rieveUnava ilableRepo rt =         
107                             (Repor t)_service Proxy.Retr ieve(Repor t.EntityLo gicalName,          
108                             _repor tId, Cols2 );        
109                         if (retrie veUnavaila bleReport. IsPersonal .Value ==  true)        
110                         {        
111                             Consol e.WriteLin e("Report  is unavail able to th e organiza tion.");        
112                         }        
113          
114          
115                         DeleteRequ iredRecord s(promptfo rDelete);        
116                    }        
117                    //</ snippetMak eReportAva ilableOrUn availableT oOrganizat ion1>        
118                }        
119                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
120                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
121                {        
122                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
123                    thro w;        
124                }        
125           }        
126          
127           // / <summary >        
128           // / This met hod create s any enti ty records  that this  sample re quires.                 
129           // / </summar y>        
130           pu blic void  CreateRequ iredRecord s()        
131           {        
132                // Defin e an anony mous type  to define  the possib le values  for        
133                // repor t type        
134                var Repo rtTypeCode  = new        
135                {        
136                    Repo rtingServi cesReport  = 1,        
137                    Othe rReport =  2,        
138                    Link edReport =  3        
139                };        
140                        
141                // Creat e a report          
142                Report n ewReport =  new Repor t        
143                {        
144                    Name  = "Sample  Report",        
145                    Desc ription =  "Report cr eated by t he SDK cod e sample." ,        
146                    Repo rtTypeCode  = new Opt ionSetValu e((int)Rep ortTypeCod e.OtherRep ort),        
147          
148                    //Ba se64-encod ed "Hello,  I am a te xt file."        
149                    Body Binary = " SGVsbG8sIE kgYW0gYSB0 ZXh0IGZpbG Uu",         
150                    File Name = "te xtfile.txt ",        
151                    IsPe rsonal = t rue        
152                };        
153                _reportI d = _servi ceProxy.Cr eate(newRe port);        
154                Console. WriteLine( "Created { 0}.", newR eport.Name );                     
155           }        
156          
157           // / <summary >        
158           // / Deletes  any entity  records t hat were c reated for  this samp le.        
159           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete         
160           // / the reco rds create d in this  sample.</p aram>        
161           // / </summar y>        
162           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
163           {        
164                bool toB eDeleted =  true;        
165          
166                if (prom pt)        
167                {        
168                    // A sk the use r if the c reated ent ities shou ld be dele ted.        
169                    Cons ole.Write( "\nDo you  want these  entity re cords dele ted? (y/n)  [y]: ");        
170                    Stri ng answer  = Console. ReadLine() ;        
171                    if ( answer.Sta rtsWith("y ") ||        
172                         answer.Sta rtsWith("Y ") ||        
173                         answer ==  String.Emp ty)        
174                    {        
175                         toBeDelete d = true;        
176                    }        
177                    else        
178                    {        
179                         toBeDelete d = false;        
180                    }        
181                }        
182          
183                if (toBe Deleted)        
184                {        
185                    // D elete all  records cr eated in t his sample .        
186                    _ser viceProxy. Delete(Rep ort.Entity LogicalNam e, _report Id);        
187                    Cons ole.WriteL ine("Entit y record(s ) have bee n deleted. ");        
188                }        
189           }        
190          
191           #e ndregion H ow To Samp le Code        
192          
193           #r egion Main  method        
194           // / <summary >        
195           // / Main. Ru ns the sam ple and pr ovides err or output.        
196           // / <param n ame="args" >Array of  arguments  to Main me thod.</par am>        
197           // / </summar y>        
198           st atic publi c void Mai n(string[]  args)        
199           {        
200                try        
201                {        
202                    // O btain the  target org anization' s Web addr ess and cl ient logon          
203                    // c redentials  from the  user.        
204                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
205                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
206          
207                    Make ReportAvai lableOrUna vailableTo Organizati on app =         
208                         new MakeRe portAvaila bleOrUnava ilableToOr ganization ();        
209                    app. Run(config , true);        
210                }        
211          
212                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
213                {        
214                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
215                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
216                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
217                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
218                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
219                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
220                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
221                }        
222                catch (S ystem.Time outExcepti on ex)        
223                {        
224                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
225                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
226                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
227                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
228                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
229                }        
230                catch (S ystem.Exce ption ex)        
231                {        
232                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
233                    Cons ole.WriteL ine(ex.Mes sage);        
234          
235                    // D isplay the  details o f the inne r exceptio n.        
236                    if ( ex.InnerEx ception !=  null)        
237                    {        
238                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
239          
240                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e        
241                             = ex.I nnerExcept ion        
242                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
243                         if (fe !=  null)        
244                         {        
245                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
246                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
247                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
248                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
249                             Consol e.WriteLin e("Inner F ault: {0}" ,        
250                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
251                         }        
252                    }        
253                }        
254                // Addit onal excep tions to c atch: Secu rityTokenV alidationE xception,  ExpiredSec urityToken Exception,        
255                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
256          
257                finally        
258                {        
259          
260                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
261                    Cons ole.ReadLi ne();        
262                }        
263          
264           }        
265           #e ndregion M ain method        
266       }        
267   }        
268   //</snippe tMakeRepor tAvailable OrUnavaila bleToOrgan ization>