Produced by Araxis Merge on 2/1/2017 2:56:27 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.
| # | 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\ScheduleAndAppointment | QueryWorkingHoursOfUser.cs | Tue Dec 20 19:51:43 2016 UTC |
| 2 | Wed Feb 1 19:56:27 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 190 |
| 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 |
No regular expressions were active.
| 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 QueryWorki ngHoursOfU ser> | |||||
| 18 | using Syst em; | |||||
| 19 | using Syst em.Linq; | |||||
| 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.Client ; | |||||
| 27 | using Micr osoft.Xrm. Sdk.Query; | |||||
| 28 | using Micr osoft.Xrm. Sdk.Discov ery; | |||||
| 29 | using Micr osoft.Xrm. Sdk.Messag es; | |||||
| 30 | ||||||
| 31 | // This na mespace is found in Microsoft. Crm.Sdk.Pr oxy.dll as sembly | |||||
| 32 | // found i n the SDK\ bin folder . | |||||
| 33 | using Micr osoft.Crm. Sdk.Messag es; | |||||
| 34 | ||||||
| 35 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 36 | { | |||||
| 37 | /// <s ummary> | |||||
| 38 | /// Th is sample shows how to retriev e the work ing hours of a user. | |||||
| 39 | /// </ summary> | |||||
| 40 | public class Que ryWorkingH oursOfUser | |||||
| 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 | #e ndregion C lass Level Members | |||||
| 50 | ||||||
| 51 | #r egion How To Sample Code | |||||
| 52 | // / <summary > | |||||
| 53 | // / Create a nd configu re the org anization service pr oxy. | |||||
| 54 | // / Retrieve the worki ng hours o f the curr ent user. | |||||
| 55 | // / Optional ly delete any entity records t hat were c reated for this samp le. | |||||
| 56 | // / </summar y> | |||||
| 57 | // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param> | |||||
| 58 | // / <param n ame="promp tforDelete ">When Tru e, the use r will be prompted t o delete a ll | |||||
| 59 | // / created entities.< /param> | |||||
| 60 | pu blic void Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete) | |||||
| 61 | { | |||||
| 62 | try | |||||
| 63 | { | |||||
| 64 | ||||||
| 65 | // C onnect to the Organi zation ser vice. | |||||
| 66 | // T he using s tatement a ssures tha t the serv ice proxy will be pr operly dis posed. | |||||
| 67 | 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 )) | |||||
| 68 | { | |||||
| 69 | // This st atement is required to enable early-boun d type sup port. | |||||
| 70 | _servicePr oxy.Enable ProxyTypes (); | |||||
| 71 | ||||||
| 72 | // Call th e method t o create a ny data th at this sa mple requi res. | |||||
| 73 | CreateRequ iredRecord s(); | |||||
| 74 | ||||||
| 75 | //<snippet QueryWorki ngHoursOfU ser1> | |||||
| 76 | // Get the current u ser's info rmation. | |||||
| 77 | WhoAmIRequ est userRe quest = ne w WhoAmIRe quest(); | |||||
| 78 | WhoAmIResp onse userR esponse = (WhoAmIRes ponse)_ser viceProxy. Execute(us erRequest) ; | |||||
| 79 | ||||||
| 80 | // Retriev e the work ing hours of the cur rent user. | |||||
| 81 | QuerySched uleRequest scheduleR equest = n ew QuerySc heduleRequ est | |||||
| 82 | { | |||||
| 83 | Resour ceId = use rResponse. UserId, | |||||
| 84 | Start = DateTime .Now, | |||||
| 85 | End = DateTime.T oday.AddDa ys(7), | |||||
| 86 | TimeCo des = new TimeCode[] { TimeCod e.Availabl e } | |||||
| 87 | }; | |||||
| 88 | QuerySched uleRespons e schedule Response = (QuerySch eduleRespo nse)_servi ceProxy.Ex ecute(sche duleReques t); | |||||
| 89 | ||||||
| 90 | // Verify if some da ta is retu rned for t he availab ility of t he current user | |||||
| 91 | if (schedu leResponse .TimeInfos .Length > 0) | |||||
| 92 | { | |||||
| 93 | Consol e.WriteLin e("Success fully quer ied the wo rking hour s of the c urrent use r."); | |||||
| 94 | } | |||||
| 95 | //</snippe tQueryWork ingHoursOf User1> | |||||
| 96 | } | |||||
| 97 | } | |||||
| 98 | // Catch any servi ce fault e xceptions that Micro soft Dynam ics CRM th rows. | |||||
| 99 | catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>) | |||||
| 100 | { | |||||
| 101 | // Y ou can han dle an exc eption her e or pass it back to the calli ng method. | |||||
| 102 | thro w; | |||||
| 103 | } | |||||
| 104 | } | |||||
| 105 | ||||||
| 106 | // / <summary > | |||||
| 107 | // / This met hod create s any enti ty records that this sample re quires. | |||||
| 108 | // / </summar y> | |||||
| 109 | pu blic void CreateRequ iredRecord s() | |||||
| 110 | { | |||||
| 111 | // No en tity recor ds are cre ated for t his sample . | |||||
| 112 | } | |||||
| 113 | ||||||
| 114 | #e ndregion H ow To Samp le Code | |||||
| 115 | ||||||
| 116 | #r egion Main | |||||
| 117 | // / <summary > | |||||
| 118 | // / Standard Main() me thod used by most SD K samples. | |||||
| 119 | // / </summar y> | |||||
| 120 | // / <param n ame="args" ></param> | |||||
| 121 | st atic publi c void Mai n(string[] args) | |||||
| 122 | { | |||||
| 123 | try | |||||
| 124 | { | |||||
| 125 | // O btain the target org anization' s Web addr ess and cl ient logon | |||||
| 126 | // c redentials from the user. | |||||
| 127 | Serv erConnecti on serverC onnect = n ew ServerC onnection( ); | |||||
| 128 | Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on(); | |||||
| 129 | ||||||
| 130 | Quer yWorkingHo ursOfUser app = new QueryWorki ngHoursOfU ser(); | |||||
| 131 | app. Run(config , true); | |||||
| 132 | } | |||||
| 133 | ||||||
| 134 | catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex ) | |||||
| 135 | { | |||||
| 136 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 137 | Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p); | |||||
| 138 | Cons ole.WriteL ine("Code: {0}", ex. Detail.Err orCode); | |||||
| 139 | Cons ole.WriteL ine("Messa ge: {0}", ex.Detail. Message); | |||||
| 140 | Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text); | |||||
| 141 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 142 | null == ex .Detail.In nerFault ? "No Inner Fault" : "Has Inner Fault"); | |||||
| 143 | } | |||||
| 144 | catch (S ystem.Time outExcepti on ex) | |||||
| 145 | { | |||||
| 146 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 147 | Cons ole.WriteL ine("Messa ge: {0}", ex.Message ); | |||||
| 148 | Cons ole.WriteL ine("Stack Trace: {0 }", ex.Sta ckTrace); | |||||
| 149 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 150 | null == ex .InnerExce ption.Mess age ? "No Inner Faul t" : ex.In nerExcepti on.Message ); | |||||
| 151 | } | |||||
| 152 | catch (S ystem.Exce ption ex) | |||||
| 153 | { | |||||
| 154 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 155 | Cons ole.WriteL ine(ex.Mes sage); | |||||
| 156 | ||||||
| 157 | // D isplay the details o f the inne r exceptio n. | |||||
| 158 | if ( ex.InnerEx ception != null) | |||||
| 159 | { | |||||
| 160 | Console.Wr iteLine(ex .InnerExce ption.Mess age); | |||||
| 161 | ||||||
| 162 | FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e | |||||
| 163 | = ex.I nnerExcept ion | |||||
| 164 | as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>; | |||||
| 165 | if (fe != null) | |||||
| 166 | { | |||||
| 167 | Consol e.WriteLin e("Timesta mp: {0}", fe.Detail. Timestamp) ; | |||||
| 168 | Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code); | |||||
| 169 | Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage); | |||||
| 170 | Consol e.WriteLin e("Plugin Trace: {0} ", fe.Deta il.TraceTe xt); | |||||
| 171 | Consol e.WriteLin e("Inner F ault: {0}" , | |||||
| 172 | nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault"); | |||||
| 173 | } | |||||
| 174 | } | |||||
| 175 | } | |||||
| 176 | // Addit ional exce ptions to catch: Sec urityToken Validation Exception, ExpiredSe curityToke nException , | |||||
| 177 | // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion. | |||||
| 178 | ||||||
| 179 | finally | |||||
| 180 | { | |||||
| 181 | ||||||
| 182 | Cons ole.WriteL ine("Press <Enter> t o exit."); | |||||
| 183 | Cons ole.ReadLi ne(); | |||||
| 184 | } | |||||
| 185 | ||||||
| 186 | } | |||||
| 187 | #e ndregion M ain | |||||
| 188 | } | |||||
| 189 | } | |||||
| 190 | //</snippe tQueryWork ingHoursOf User> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.