691. Araxis Merge File Comparison Report

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

691.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\WsdlBasedProxies\Online Program.cs Tue Dec 20 19:51:47 2016 UTC
2 Wed Feb 1 19:56:56 2017 UTC

691.2 Comparison summary

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

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

691.4 Active regular expressions

No regular expressions were active.

691.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   using Syst em;        
18   using Syst em.Collect ions.Gener ic;        
19   using Syst em.Globali zation;        
20   using Syst em.Identit yModel.Tok ens;        
21   using Syst em.Service Model;        
22   using Syst em.Service Model.Desc ription;        
23          
24   using Micr osoft.Crm. Services.U tility;        
25          
26   namespace  Microsoft. Crm.Sdk.Sa mples        
27   {        
28       using  CrmSdk;        
29       using  CrmSdk.Dis covery;        
30          
31       intern al static  class Prog ram        
32       {        
33           #r egion Cons tants        
34           // / <summary >        
35           // / Microsof t account  (e.g. your email@live .com) or M icrosoft O ffice 365  (Org ID e. g. yourema il@yourorg .onmicroso ft.com) Us er Name.        
36           // / </summar y>        
37           pr ivate cons t string U serName =  "youremail @yourorg.o nmicrosoft .com";        
38          
39           // / <summary >        
40           // / Microsof t account  or Microso ft Office  365 (Org I D) Passwor d.        
41           // / </summar y>        
42           pr ivate cons t string U serPasswor d = "passw ord";        
43          
44           // / <summary >        
45           // / Unique N ame of the  organizat ion        
46           // / </summar y>        
47           pr ivate cons t string O rganizatio nUniqueNam e = "orgna me";        
48          
49           // / <summary >        
50           // / URL for  the Discov ery Servic e        
51           // / For Nort h America        
52           // /     Micr osoft acco unt, disco very servi ce url cou ld be http s://dev.cr m.dynamics .com/XRMSe rvices/201 1/Discover y.svc        
53           // /     Micr osoft Offi ce 365, di scovery se rvice url  could be h ttps://dis co.crm.dyn amics.com/ XRMService s/2011/Dis covery.svc        
54           // / To use a ppropriate  discovery  service u rl for oth er environ ments refe r http://t echnet.mic rosoft.com /en-us/lib rary/gg309 401.aspx        
55           //        
56           // / </summar y>        
57           pr ivate cons t string D iscoverySe rviceUrl =  "https:// disco.crm. dynamics.c om/XRMServ ices/2011/ Discovery. svc";        
58          
59           // / <summary >        
60           // / Suffix f or the Fla t WSDL        
61           // / </summar y>        
62           pr ivate cons t string W sdlSuffix  = "?wsdl";        
63           #e ndregion        
64          
65           st atic void  Main(strin g[] args)        
66           {        
67                // Retri eve the au thenticati on policy  for the Di scovery se rvice.        
68                OnlineAu thenticati onPolicy d iscoveryPo licy =        
69                     new  OnlineAut henticatio nPolicy(Di scoverySer viceUrl +  WsdlSuffix );        
70                // Authe nticate th e user usi ng the aut henticatio n policy.        
71                Security Token disc overyToken  = Authent icate(disc overyPolic y, UserNam e, UserPas sword);        
72          
73                // Retri eve the or ganization  service U RL for the  given org anization        
74                string o rganizatio nServiceUr l = Discov erOrganiza tionUrl(di scoveryTok en, Organi zationUniq ueName, Di scoverySer viceUrl,        
75                    disc overyPolic y.IssuerUr i);        
76          
77                // The D iscovery S ervice tok en cannot  be reused  against th e Organiza tion Servi ce as the  Issuer and  AppliesTo  may diffe r between        
78                // the d iscovery a nd organiz ation serv ices.        
79                OnlineAu thenticati onPolicy o rganizatio nPolicy =        
80                    new  OnlineAuth entication Policy(org anizationS erviceUrl  + WsdlSuff ix);        
81                Security Token orga nizationTo ken = Auth enticate(o rganizatio nPolicy, U serName, U serPasswor d);        
82          
83                // Execu te the sam ple        
84                ExecuteW hoAmI(orga nizationTo ken, organ izationSer viceUrl, o rganizatio nPolicy.Is suerUri);        
85          
86                Console. Write("Pre ss [Enter]  to exit.. .. ");        
87                Console. ReadLine() ;        
88           }        
89          
90           pr ivate stat ic Securit yToken Aut henticate( OnlineAuth entication Policy pol icy, strin g userName , string p assword)        
91           {        
92                ClientCr edentials  credential s = new Cl ientCreden tials();        
93                credenti als.UserNa me.UserNam e = userNa me;        
94                credenti als.UserNa me.Passwor d = passwo rd;        
95          
96                return W sdlTokenMa nager.Auth enticate(c redentials , policy.A ppliesTo,  policy.Pol icy, polic y.IssuerUr i);        
97           }        
98          
99           pr ivate stat ic string  DiscoverOr ganization Url(Securi tyToken to ken, strin g organiza tionName,  string dis coveryServ iceUrl, Ur i issuerUr i)        
100           {        
101                using (D iscoverySe rviceClien t client =  new Disco veryServic eClient("C ustomBindi ng_IDiscov eryService ", discove ryServiceU rl))        
102                {        
103                    clie nt.Configu reCrmOnlin eBinding(i ssuerUri);        
104                    clie nt.Token =  token;        
105          
106                    Retr ieveOrgani zationRequ est reques t = new Re trieveOrga nizationRe quest()        
107                    {        
108                         UniqueName  = organiz ationName        
109                    };        
110                    Retr ieveOrgani zationResp onse respo nse;        
111                    try        
112                    {        
113                         response =  (Retrieve Organizati onResponse )client.Ex ecute(requ est);        
114                    }        
115                    catc h (Communi cationExce ption)        
116                    {        
117                         throw;        
118                    }        
119          
120                    fore ach (KeyVa luePair<En dpointType , string>  endpoint i n response .Detail.En dpoints)        
121                    {        
122                         if (Endpoi ntType.Org anizationS ervice ==  endpoint.K ey)        
123                         {        
124                             Consol e.WriteLin e("Organiz ation Serv ice URL: { 0}", endpo int.Value) ;        
125                             return  endpoint. Value;        
126                         }        
127                    }        
128          
129                    thro w new Inva lidOperati onExceptio n(string.F ormat(Cult ureInfo.In variantCul ture,        
130                         "Organizat ion {0} do es not hav e an Organ izationSer vice endpo int define d.", organ izationNam e));        
131                }        
132           }        
133          
134           pr ivate stat ic void Ex ecuteWhoAm I(Security Token toke n, string  serviceUrl , Uri issu erUri)        
135           {        
136                using (O rganizatio nServiceCl ient clien t = new Or ganization ServiceCli ent("Custo mBinding_I Organizati onService" ,        
137                    new  EndpointAd dress(serv iceUrl)))        
138                {        
139                    clie nt.Configu reCrmOnlin eBinding(i ssuerUri);        
140                    clie nt.Token =  token;        
141          
142                    Orga nizationRe quest requ est = new  Organizati onRequest( );        
143                    requ est.Reques tName = "W hoAmI";        
144          
145                    Orga nizationRe sponse res ponse = (O rganizatio nResponse) client.Exe cute(reque st);        
146          
147                    fore ach (KeyVa luePair<st ring, obje ct> result  in respon se.Results )        
148                    {        
149                         if ("UserI d" == resu lt.Key)        
150                         {        
151                             Consol e.WriteLin e("User ID : {0}", re sult.Value );        
152                             break;        
153                         }        
154                    }        
155                }        
156           }        
157       }        
158   }