Produced by Araxis Merge on 2/1/2017 2:56:23 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\BusinessManagement | CreateQueue.cs | Tue Dec 20 19:51:44 2016 UTC |
| 2 | Wed Feb 1 19:56:23 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 236 |
| 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 CreateQueu e> | |||||
| 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.Query; | |||||
| 27 | using Micr osoft.Xrm. Sdk.Client ; | |||||
| 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 create a simple q ueue insta nce. | |||||
| 39 | /// </ summary> | |||||
| 40 | public class Cre ateQueue | |||||
| 41 | { | |||||
| 42 | #r egion Clas s Level Me mbers | |||||
| 43 | // / <summary > | |||||
| 44 | // / Stores t he organiz ation serv ice proxy. | |||||
| 45 | // / </summar y> | |||||
| 46 | pr ivate Orga nizationSe rviceProxy _serviceP roxy; | |||||
| 47 | ||||||
| 48 | // Define th e IDs as w ell as str ings neede d for this sample. | |||||
| 49 | pu blic Guid _queueId; | |||||
| 50 | ||||||
| 51 | #e ndregion C lass Level Members | |||||
| 52 | ||||||
| 53 | #r egion How To Sample Code | |||||
| 54 | // / <summary > | |||||
| 55 | // / Create a nd configu re the org anization service pr oxy. | |||||
| 56 | // / Create a new queue instance. | |||||
| 57 | // / Optional ly delete any entity records t hat were c reated for this samp le. | |||||
| 58 | // / </summar y> | |||||
| 59 | // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param> | |||||
| 60 | // / <param n ame="promp tforDelete ">When Tru e, the use r will be prompted t o delete a ll | |||||
| 61 | // / created entities.< /param> | |||||
| 62 | pu blic void Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete) | |||||
| 63 | { | |||||
| 64 | try | |||||
| 65 | { | |||||
| 66 | // C onnect to the Organi zation ser vice. | |||||
| 67 | // T he using s tatement a ssures tha t the serv ice proxy will be pr operly dis posed. | |||||
| 68 | usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri, | |||||
| 69 | s erverConfi g.Credenti als, serve rConfig.De viceCreden tials)) | |||||
| 70 | { | |||||
| 71 | // This st atement is required to enable early-boun d type sup port. | |||||
| 72 | _servicePr oxy.Enable ProxyTypes (); | |||||
| 73 | ||||||
| 74 | //<snippet CreateQueu e1> | |||||
| 75 | // Define some anony mous types to define the range of possib le | |||||
| 76 | // queue p roperty va lues. | |||||
| 77 | var Incomi ngEmailDel iveryMetho ds = new | |||||
| 78 | { | |||||
| 79 | None = 0, | |||||
| 80 | EmailR outer = 2, | |||||
| 81 | Forwar dMailbox = 3 | |||||
| 82 | }; | |||||
| 83 | ||||||
| 84 | var Incomi ngEmailFil teringMeth ods = new | |||||
| 85 | { | |||||
| 86 | AllEma ilMessages = 0, | |||||
| 87 | EmailM essagesInR esponseToC rmEmail = 1, | |||||
| 88 | EmailM essagesFro mCrmLeadsC ontactsAnd Accounts = 2 | |||||
| 89 | }; | |||||
| 90 | ||||||
| 91 | var Outgoi ngEmailDel iveryMetho ds = new | |||||
| 92 | { | |||||
| 93 | None = 0, | |||||
| 94 | EmailR outer = 2 | |||||
| 95 | }; | |||||
| 96 | ||||||
| 97 | var QueueV iewType = new | |||||
| 98 | { | |||||
| 99 | Public = 0, | |||||
| 100 | Privat e = 1 | |||||
| 101 | }; | |||||
| 102 | // Create a queue in stance and set its p roperty va lues. | |||||
| 103 | Queue newQ ueue = new Queue() | |||||
| 104 | { | |||||
| 105 | Name = "Example Queue.", | |||||
| 106 | Descri ption = "T his is an example qu eue.", | |||||
| 107 | Incomi ngEmailDel iveryMetho d = new Op tionSetVal ue( | |||||
| 108 | In comingEmai lDeliveryM ethods.Non e), | |||||
| 109 | Incomi ngEmailFil teringMeth od = new O ptionSetVa lue( | |||||
| 110 | In comingEmai lFiltering Methods.Al lEmailMess ages), | |||||
| 111 | Outgoi ngEmailDel iveryMetho d = new Op tionSetVal ue( | |||||
| 112 | Ou tgoingEmai lDeliveryM ethods.Non e), | |||||
| 113 | QueueV iewType = new Option SetValue( | |||||
| 114 | Qu eueViewTyp e.Private) | |||||
| 115 | }; | |||||
| 116 | ||||||
| 117 | // Create a new queu e instance . | |||||
| 118 | _queueId = _serviceP roxy.Creat e(newQueue ); | |||||
| 119 | //</snippe tCreateQue ue1> | |||||
| 120 | ||||||
| 121 | Console.Wr iteLine("C reated {0} ", newQueu e.Name); | |||||
| 122 | ||||||
| 123 | DeleteRequ iredRecord s(promptFo rDelete); | |||||
| 124 | } | |||||
| 125 | } | |||||
| 126 | ||||||
| 127 | // Catch any servi ce fault e xceptions that Micro soft Dynam ics CRM th rows. | |||||
| 128 | catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>) | |||||
| 129 | { | |||||
| 130 | // Y ou can han dle an exc eption her e or pass it back to the calli ng method. | |||||
| 131 | thro w; | |||||
| 132 | } | |||||
| 133 | } | |||||
| 134 | ||||||
| 135 | ||||||
| 136 | // / <summary > | |||||
| 137 | // / Deletes any entity records t hat were c reated for this samp le. | |||||
| 138 | // / <param n ame="promp t">Indicat es whether to prompt the user to delete | |||||
| 139 | // / the reco rds create d in this sample.</p aram> | |||||
| 140 | // / </summar y> | |||||
| 141 | pu blic void DeleteRequ iredRecord s(bool pro mpt) | |||||
| 142 | { | |||||
| 143 | bool del eteRecords = true; | |||||
| 144 | ||||||
| 145 | if (prom pt) | |||||
| 146 | { | |||||
| 147 | Cons ole.WriteL ine("\nDo you want t hese entit y records to be dele ted? (y/n) "); | |||||
| 148 | Stri ng answer = Console. ReadLine() ; | |||||
| 149 | ||||||
| 150 | dele teRecords = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" )); | |||||
| 151 | } | |||||
| 152 | ||||||
| 153 | if (dele teRecords) | |||||
| 154 | { | |||||
| 155 | _ser viceProxy. Delete(Que ue.EntityL ogicalName , | |||||
| 156 | _queueId); | |||||
| 157 | ||||||
| 158 | Cons ole.WriteL ine("Entit y records have been deleted.") ; | |||||
| 159 | } | |||||
| 160 | } | |||||
| 161 | ||||||
| 162 | #e ndregion H ow To Samp le Code | |||||
| 163 | ||||||
| 164 | #r egion Main | |||||
| 165 | ||||||
| 166 | // / <summary > | |||||
| 167 | // / Standard Main() me thod used by most SD K samples. | |||||
| 168 | // / </summar y> | |||||
| 169 | // / <param n ame="args" ></param> | |||||
| 170 | st atic publi c void Mai n(string[] args) | |||||
| 171 | { | |||||
| 172 | try | |||||
| 173 | { | |||||
| 174 | // O btain the target org anization' s Web addr ess and cl ient logon | |||||
| 175 | // c redentials from the user. | |||||
| 176 | Serv erConnecti on serverC onnect = n ew ServerC onnection( ); | |||||
| 177 | Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on(); | |||||
| 178 | ||||||
| 179 | Crea teQueue ap p = new Cr eateQueue( ); | |||||
| 180 | app. Run(config , true); | |||||
| 181 | } | |||||
| 182 | catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex ) | |||||
| 183 | { | |||||
| 184 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 185 | Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p); | |||||
| 186 | Cons ole.WriteL ine("Code: {0}", ex. Detail.Err orCode); | |||||
| 187 | Cons ole.WriteL ine("Messa ge: {0}", ex.Detail. Message); | |||||
| 188 | Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text); | |||||
| 189 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 190 | null == ex .Detail.In nerFault ? "No Inner Fault" : "Has Inner Fault"); | |||||
| 191 | } | |||||
| 192 | catch (S ystem.Time outExcepti on ex) | |||||
| 193 | { | |||||
| 194 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 195 | Cons ole.WriteL ine("Messa ge: {0}", ex.Message ); | |||||
| 196 | Cons ole.WriteL ine("Stack Trace: {0 }", ex.Sta ckTrace); | |||||
| 197 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 198 | null == ex .InnerExce ption.Mess age ? "No Inner Faul t" : ex.In nerExcepti on.Message ); | |||||
| 199 | } | |||||
| 200 | catch (S ystem.Exce ption ex) | |||||
| 201 | { | |||||
| 202 | Cons ole.WriteL ine("The a pplication terminate d with an error."); | |||||
| 203 | Cons ole.WriteL ine(ex.Mes sage); | |||||
| 204 | ||||||
| 205 | // D isplay the details o f the inne r exceptio n. | |||||
| 206 | if ( ex.InnerEx ception != null) | |||||
| 207 | { | |||||
| 208 | Console.Wr iteLine(ex .InnerExce ption.Mess age); | |||||
| 209 | ||||||
| 210 | FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e | |||||
| 211 | = ex.I nnerExcept ion | |||||
| 212 | as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>; | |||||
| 213 | if (fe != null) | |||||
| 214 | { | |||||
| 215 | Consol e.WriteLin e("Timesta mp: {0}", fe.Detail. Timestamp) ; | |||||
| 216 | Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code); | |||||
| 217 | Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage); | |||||
| 218 | Consol e.WriteLin e("Plugin Trace: {0} ", fe.Deta il.TraceTe xt); | |||||
| 219 | Consol e.WriteLin e("Inner F ault: {0}" , | |||||
| 220 | nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault"); | |||||
| 221 | } | |||||
| 222 | } | |||||
| 223 | } | |||||
| 224 | // Addit ional exce ptions to catch: Sec urityToken Validation Exception, ExpiredSe curityToke nException , | |||||
| 225 | // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion. | |||||
| 226 | finally | |||||
| 227 | { | |||||
| 228 | Cons ole.WriteL ine("Press <Enter> t o exit."); | |||||
| 229 | Cons ole.ReadLi ne(); | |||||
| 230 | } | |||||
| 231 | ||||||
| 232 | } | |||||
| 233 | #e ndregion M ain | |||||
| 234 | } | |||||
| 235 | } | |||||
| 236 | //</snippe tCreateQue ue> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.