Produced by Araxis Merge on 2/1/2017 2:56:52 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\Process\CustomWorkflowActivities\PostUrl | PostUrl.cs | Tue Dec 20 19:51:45 2016 UTC |
| 2 | Wed Feb 1 19:56:52 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 98 |
| 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 | // This f ile is par t of the M icrosoft D ynamics CR M SDK code samples. | |||||
| 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 PostUrl> | |||||
| 17 | using Syst em; | |||||
| 18 | using Syst em.Activit ies; | |||||
| 19 | using Syst em.IO; | |||||
| 20 | using Syst em.Net; | |||||
| 21 | using Syst em.Text; | |||||
| 22 | ||||||
| 23 | // These n amespaces are found in the Mic rosoft.Xrm .Sdk.dll a ssembly | |||||
| 24 | // located in the SD K\bin fold er of the SDK downlo ad. | |||||
| 25 | using Micr osoft.Xrm. Sdk; | |||||
| 26 | ||||||
| 27 | // These n amespaces are found in the Mic rosoft.Xrm .Sdk.Workf low.dll as sembly | |||||
| 28 | // located in the SD K\bin fold er of the SDK downlo ad. | |||||
| 29 | using Micr osoft.Xrm. Sdk.Workfl ow; | |||||
| 30 | ||||||
| 31 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 32 | { | |||||
| 33 | /// <s ummary> | |||||
| 34 | /// Po sts data i n a url. | |||||
| 35 | /// In put argume nts: | |||||
| 36 | /// "URL". Typ e: String. Is the UR L to which you will be posting data. | |||||
| 37 | /// "Account N ame". Type : String. Is part of the data to post. | |||||
| 38 | /// "Account N um". Type: String. I s part of the data t o post. | |||||
| 39 | /// Ou tput argum ent: | |||||
| 40 | /// None. | |||||
| 41 | /// </ summary> | |||||
| 42 | public sealed pa rtial clas s PostUrl : CodeActi vity | |||||
| 43 | { | |||||
| 44 | // / <summary > | |||||
| 45 | // / NOTE: Wh en you add this acti vity to a workflow, you must s et the fol lowing pro perties: | |||||
| 46 | // / | |||||
| 47 | // / URL - ma nually add the URL t o which yo u will be posting da ta. For e xample: ht tp://myser ver.com/Re ceivePostU RL.aspx | |||||
| 48 | // / See t his sample 's compani on file 'R eceivePost URL.aspx' for an exa mple of ho w the rece iving page might loo k. | |||||
| 49 | // / | |||||
| 50 | // / AccountN ame - popu late this property w ith the Ac count's 'n ame' attri bute. | |||||
| 51 | // / | |||||
| 52 | // / AccountN um - popul ate this p roperty wi th the Acc ount's 'ac count numb er' attrib ute. | |||||
| 53 | // / </summar y> | |||||
| 54 | pr otected ov erride voi d Execute( CodeActivi tyContext executionC ontext) | |||||
| 55 | { | |||||
| 56 | IWorkflo wContext c ontext = e xecutionCo ntext.GetE xtension<I WorkflowCo ntext>(); | |||||
| 57 | IOrganiz ationServi ceFactory serviceFac tory = | |||||
| 58 | exec utionConte xt.GetExte nsion<IOrg anizationS erviceFact ory>(); | |||||
| 59 | IOrganiz ationServi ce service = | |||||
| 60 | serv iceFactory .CreateOrg anizationS ervice(con text.UserI d); | |||||
| 61 | ||||||
| 62 | // Build data that will be p osted to a URL | |||||
| 63 | string p ostData = "Name=" + this.Accou ntName.Get (execution Context) + "&Account Num=" + th is.Account Num.Get(ex ecutionCon text); | |||||
| 64 | ||||||
| 65 | // Encod e the data | |||||
| 66 | ASCIIEnc oding enco ding = new ASCIIEnco ding(); | |||||
| 67 | byte[] e ncodedPost Data = enc oding.GetB ytes(postD ata); | |||||
| 68 | ||||||
| 69 | // Creat e a reques t object f or posting our data to a URL | |||||
| 70 | Uri uri = new Uri( this.URL.G et(executi onContext) ); | |||||
| 71 | HttpWebR equest url Request = (HttpWebRe quest)WebR equest.Cre ate(uri); | |||||
| 72 | urlReque st.Method = "POST"; | |||||
| 73 | urlReque st.Content Length = e ncodedPost Data.Lengt h; | |||||
| 74 | urlReque st.Content Type = "ap plication/ x-www-form -urlencode d"; | |||||
| 75 | ||||||
| 76 | // Add t he encoded data to t he request | |||||
| 77 | using (S tream form Writer = u rlRequest. GetRequest Stream()) | |||||
| 78 | { | |||||
| 79 | form Writer.Wri te(encoded PostData, 0, encoded PostData.L ength); | |||||
| 80 | } | |||||
| 81 | ||||||
| 82 | // Post the data t o the URL | |||||
| 83 | HttpWebR esponse ur lResponse = (HttpWeb Response)u rlRequest. GetRespons e(); | |||||
| 84 | } | |||||
| 85 | ||||||
| 86 | // Define In put/Output Arguments | |||||
| 87 | [I nput("URL" )] | |||||
| 88 | [D efault("ht tp://local host:9999/ ReceivePos tURL.aspx" )] | |||||
| 89 | pu blic InArg ument<stri ng> URL { get; set; } | |||||
| 90 | ||||||
| 91 | [I nput("Acco unt Name") ] | |||||
| 92 | pu blic InArg ument<stri ng> Accoun tName { ge t; set; } | |||||
| 93 | ||||||
| 94 | [I nput("Acco unt Num")] | |||||
| 95 | pu blic InArg ument<stri ng> Accoun tNum { get ; set; } | |||||
| 96 | } | |||||
| 97 | } | |||||
| 98 | //</snippe tPostUrl> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.