{"id":2680,"date":"2013-09-05T02:28:41","date_gmt":"2013-09-05T02:28:41","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?page_id=2680"},"modified":"2013-09-05T02:58:03","modified_gmt":"2013-09-05T02:58:03","slug":"teched-demo-2-script-using-workflowdata","status":"publish","type":"page","link":"https:\/\/www.wapshere.com\/missmiis\/teched-demo-1-hello-world-script\/teched-demo-2-script-using-workflowdata","title":{"rendered":"TechEd Demo 2: Script using WorkflowData"},"content":{"rendered":"<p>###<br \/>\n### Export request details and Workflow Data to a text file.<br \/>\n### Write an event with the message from [\/\/WorkflowData\/Message]<br \/>\n###<\/p>\n<p>## Write the Request Details to a log file<br \/>\nif ($fimwf)<br \/>\n{<br \/>\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 &#8220;Request details: &#8221; +<br \/>\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 ($fimwf\u00c2\u00a0 | Out-String -Width 100) + &#8220;Workflow Data:`n&#8221; +<br \/>\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 ($fimwf.WorkflowDictionary\u00c2\u00a0 | Out-String -Width 100 ) | out-file -FilePath &#8220;C:\\demo\\demo2\\wfdata.txt&#8221; -Encoding &#8220;Default&#8221;<br \/>\n}<\/p>\n<p>## Write the Message into the Event Log<br \/>\nif (-not $fimwf.WorkflowDictionary.ContainsKey(&#8220;Message&#8221;)) {Throw &#8220;WorkflowData parameter &#8216;Message&#8217; was not found&#8221;}<br \/>\nWrite-EventLog -LogName Application -Source PowerShellActivity -Message $fimwf.WorkflowDictionary.Message -EntryType &#8220;Information&#8221; -EventID 0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### ### Export request details and Workflow Data to a text file. ### Write an event with the message from [\/\/WorkflowData\/Message] ### ## Write the Request Details to a log file if ($fimwf) { \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 &#8220;Request details: &#8221; + \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 ($fimwf\u00c2\u00a0 | Out-String -Width 100) + &#8220;Workflow Data:`n&#8221; + \u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 ($fimwf.WorkflowDictionary\u00c2\u00a0 | Out-String -Width 100&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2677,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-2680","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/Pkp1o-He","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/2680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=2680"}],"version-history":[{"count":3,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/2680\/revisions"}],"predecessor-version":[{"id":2682,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/2680\/revisions\/2682"}],"up":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/2677"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=2680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}