<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Akash Blogging......</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/akashb/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/akashb/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 14 Nov 2017 21:09:51 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>EWS Script to automatically generate registry keys to enable Custom Forms in Outlook</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/ews-script-to-automatically-generate-registry-keys-to-enable-custom-forms-in-outlook</link>
      <pubDate>Tue, 14 Nov 2017 21:09:50 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/?p=1455</guid>
      <description><![CDATA[As you know Custom form script is now disabled by default and you will need to create a set of...]]></description>
      <content:encoded><![CDATA[<p><br>As you know Custom form script is now disabled by default and you will need to create a set of registry keys as outlined in <a href="https://support.office.com/en-us/article/Custom-form-script-is-now-disabled-by-default-bd8ea308-733f-4728-bfcc-d7cce0120e94">this</a> KB. We have had a few customers who have a lot of custom forms published in the Organizational Forms Library and it can be painful to get the message class of each of those form and then create the registry entries. The script below iterates through all the forms published in the Organizational Forms Library and then generates the required set of registry keys. </p> <p>This is a PowerShell script that uses <a href="https://www.microsoft.com/en-us/download/details.aspx?id=42951" target="_blank">EWS Managed API Ver 2.2</a> to access the Organizational Forms Library and generate the registry keys. This script will need to be run with credentials of a user that has access to the Organizational Forms Library.</p> <div id="codeSnippetWrapper" style="font-size: 8pt;overflow: auto;cursor: text;border-top: silver 1px solid;height: 1000px;font-family: 'Courier New', courier, monospace;border-right: silver 1px solid;width: 100%;border-bottom: silver 1px solid;padding-bottom: 4px;direction: ltr;text-align: left;padding-top: 4px;padding-left: 4px;border-left: silver 1px solid;margin: 20px 0px 10px;line-height: 12pt;padding-right: 4px;max-height: 2000px;background-color: #f4f4f4"> <div id="codeSnippet" style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000">#</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000"># DumpMessageClassforForms.ps1</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000">#</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000"># By Akash Bhargava, Microsoft Ltd. 2017. Use at your own risk.  No warranties are given.</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># Thank you David for the Template</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000"># DISCLAIMER:</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># THIS CODE IS SAMPLE CODE. THESE SAMPLES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000"># MICROSOFT FURTHER DISCLAIMS ALL IMPLIED WARRANTIES INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF THE SAMPLES REMAINS WITH YOU. IN NO EVENT SHALL</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000"># MICROSOFT OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000"># SAMPLES, EVEN IF MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #0000ff">param</span> (</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    [Parameter(Mandatory=$False,HelpMessage=<span style="color: #006080">"Username used to authenticate with EWS"</span>)]</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [string]$AuthUsername,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [Parameter(Mandatory=$False,HelpMessage=<span style="color: #006080">"Password used to authenticate with EWS"</span>)]</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    [string]$AuthPassword,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    [Parameter(Mandatory=$False,HelpMessage=<span style="color: #006080">"Domain used to authenticate with EWS"</span>)]</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [string]$AuthDomain,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [Parameter(Mandatory=$False,HelpMessage=<span style="color: #006080">"EWS Url (if omitted, then autodiscover is used)"</span>)]    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    [string]$EwsUrl,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    [Parameter(Mandatory=$False,HelpMessage=<span style="color: #006080">"Path to managed API (if omitted, a search of standard paths is performed)"</span>)]    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [string]$EWSManagedApiPath = <span style="color: #006080">""</span>,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [Parameter(Mandatory=$False,HelpMessage=<span style="color: #006080">"Whether to ignore any SSL errors (e.g. invalid certificate)"</span>)]    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    [<span style="color: #0000ff">switch</span>]$IgnoreSSLCertificate,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    [Parameter(Mandatory=$False,HelpMessage=<span style="color: #006080">"Bitness of Outlook and Windows"</span>)]</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [string]$Bitness = <span style="color: #006080">"x32on64"</span>,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [Parameter(Mandatory=$False,HelpMessage=<span style="color: #006080">"Log file - activity is logged to this file if specified"</span>)]    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    [string]$LogFile = <span style="color: #006080">""</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">[string]$info = <span style="color: #006080">"White"</span>                <span style="color: #008000"># Color for informational messages</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">[string]$warning = <span style="color: #006080">"Yellow"</span>            <span style="color: #008000"># Color for warning messages</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">[string]$error = <span style="color: #006080">"Red"</span>                 <span style="color: #008000">#Color for error messages</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">[string]$success = <span style="color: #006080">"Green"</span>             <span style="color: #008000"># Color for success messages</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">[string]$LogFile = <span style="color: #006080">"Log.txt"</span>   <span style="color: #008000"># Path of the Log File</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">[string]$RegFile = <span style="color: #006080">"CustomFormKeys.reg"</span>   <span style="color: #008000"># Path of the Reg File</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># Define our functions</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">Function Log([string]$Details, [ConsoleColor]$Colour)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">{</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #0000ff">if</span> ($Colour <span style="color: #cc6633">-eq</span> $null)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        $Colour = [ConsoleColor]::White</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #0000ff">if</span> ($verbose)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    {    Write-Host $Details -ForegroundColor $Colour }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #0000ff">if</span> ( $LogFile <span style="color: #cc6633">-eq</span> <span style="color: #006080">""</span> ) { <span style="color: #0000ff">return</span>    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    (Get-Date).ToString()+<span style="color: #006080">" "</span>+ $Details | Out-File $LogFile -Append</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">}</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">Function LoadEWSManagedAPI()</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">{</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #008000"># Find and load the managed API</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #0000ff">if</span> ( ![string]::IsNullOrEmpty($EWSManagedApiPath) )</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        <span style="color: #0000ff">if</span> ( Test-Path $EWSManagedApiPath )</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            Add-Type -Path $EWSManagedApiPath</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            <span style="color: #0000ff">return</span> $true</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        Write-Host ( [string]::Format(<span style="color: #006080">"Managed API not found at specified location: {0}"</span>, $EWSManagedApiPath) ) -ForegroundColor $error</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $a = Get-ChildItem -Recurse <span style="color: #006080">"C:\Program Files (x86)\Microsoft\Exchange\Web Services"</span> -ErrorAction SilentlyContinue | Where-Object { ($_.PSIsContainer <span style="color: #cc6633">-eq</span> $false) -and ( $_.Name <span style="color: #cc6633">-eq</span> <span style="color: #006080">"Microsoft.Exchange.WebServices.dll"</span> ) }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #0000ff">if</span> (!$a)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        $a = Get-ChildItem -Recurse <span style="color: #006080">"C:\Program Files\Microsoft\Exchange\Web Services"</span> -ErrorAction SilentlyContinue | Where-Object { ($_.PSIsContainer <span style="color: #cc6633">-eq</span> $false) -and ( $_.Name <span style="color: #cc6633">-eq</span> <span style="color: #006080">"Microsoft.Exchange.WebServices.dll"</span> ) }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #0000ff">if</span> ($a)    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        <span style="color: #008000"># Load EWS Managed API</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        Write-Host ([string]::Format(<span style="color: #006080">"Using managed API {0} found at: {1}"</span>, $a.VersionInfo.FileVersion, $a.VersionInfo.FileName)) -ForegroundColor $success</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        Add-Type -Path $a.VersionInfo.FileName</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        <span style="color: #0000ff">return</span> $true</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #0000ff">return</span> $false</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">}</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">Function SearchOrganizationalFormsLibrary()</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">{</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #008000"># Set EWS URL if specified, or use autodiscover if no URL specified.</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #0000ff">if</span> ($EwsUrl)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        $service.URL = New-Object Uri($EwsUrl)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $LogExists = Test-Path $LogFile</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #0000ff">if</span> ($LogExists){Remove-Item  $LogFile}</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $RegExists = Test-Path $RegFile</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #0000ff">if</span> ($RegExists){Remove-Item  $RegFile}</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $nl = [Environment]::NewLine</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $RegFixFile = $null;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #0000ff">if</span> ($Bitness)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        <span style="color: #0000ff">if</span> ($Bitness <span style="color: #cc6633">-eq</span> <span style="color: #006080">"x32on64"</span>)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            $RegFixFile=<span style="color: #006080">"Windows Registry Editor Version 5.00"</span> + $nl + <span style="color: #006080">"[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Security]"</span> + $nl + <span style="color: #006080">"`"</span>DisableCustomFormItemScript`<span style="color: #006080">"=dword:00000000"</span> + $nl +</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            <span style="color: #006080">"[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList]"</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        <span style="color: #0000ff">else</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            $RegFixFile=<span style="color: #006080">"Windows Registry Editor Version 5.00"</span> + $nl + <span style="color: #006080">"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Security]"</span> + $nl + <span style="color: #006080">"`"</span>DisableCustomFormItemScript`<span style="color: #006080">"=dword:00000000"</span> + $nl +</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            <span style="color: #006080">"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList]"</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        Log <span style="color: #006080">"Looking for Custom Forms.."</span> $info </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #008000">#Bind to the Public Folders Root</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $PFRoot = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::PublicFoldersRoot)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #008000">#$PFRoot</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #008000">#Get to Its Parent</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $ParentofPFRoot = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$PFRoot.ParentFolderId)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #008000">#Folder View</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $oFolderView = new-object Microsoft.Exchange.WebServices.Data.FolderView(10)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #008000">#Item View</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $PR_OAB_NAME = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x6800,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $oItemView = New-Object Microsoft.Exchange.WebServices.Data.ItemView(500)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $oItemView.PropertySet = New-Object Microsoft.Exchange.WebServices.Data.PropertySet(</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        [Microsoft.Exchange.WebServices.Data.BasePropertySet]::IdOnly,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        [Microsoft.Exchange.WebServices.Data.ItemSchema]::Subject,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        $PR_OAB_NAME)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $oItemView.Traversal = [Microsoft.Exchange.WebServices.Data.ItemTraversal]::Associated</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $oFindFolderResults = $service.FindFolders($ParentofPFRoot.Id,$oFolderView)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #008000">#Now Bind to the NON_IPM_SUBTREE</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $NON_IPM_SUBTREE = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$oFindFolderResults.Folders[1].Id)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    ForEach ($subFolder <span style="color: #0000ff">in</span> $NON_IPM_SUBTREE.FindFolders($oFolderView))</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        <span style="color: #0000ff">if</span> ($subFolder.DisplayName <span style="color: #cc6633">-eq</span> <span style="color: #006080">"EFORMS REGISTRY"</span>)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            <span style="color: #008000">#Get to the "Organizational Forms Library"</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            $oFindFolderResultsOFL = $service.FindFolders($subFolder.Id,$oFolderView)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            <span style="color: #008000">#Look at the associated contents folder..</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            $results = $service.FindItems( $oFindFolderResultsOFL.Folders[0].Id, $oItemView )</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            $RegFixFile | Out-File $RegFile -Append</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            Log <span style="color: #006080">"Looping through the Messages..."</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            ForEach ($item <span style="color: #0000ff">in</span> $results.Items)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">                $FormMessageClass =$null;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">                <span style="color: #0000ff">if</span> ($Item.TryGetProperty($PR_OAB_NAME,[ref] $FormMessageClass))</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">                {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">                    <span style="color: #008000">#Generate the RegKeys..                </span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">                    Log([string]::Format(<span style="color: #006080">"Creating Key for :{0}"</span>, $FormMessageClass))</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">                    Write-Host ([string]::Format(<span style="color: #006080">"Creating Key for :{0}"</span>, $FormMessageClass)) -ForegroundColor $success</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">                    <span style="color: #006080">'"'</span> + $FormMessageClass +<span style="color: #006080">'"'</span>+ <span style="color: #006080">"="</span> +<span style="color: #006080">'"'</span> + <span style="color: #006080">'"'</span> |Out-File $RegFile -Append</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">                }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    Log <span style="color: #006080">"Done!"</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">}</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">Function TrustAllCerts() {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    &lt;<span style="color: #008000">#</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    .SYNOPSIS</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    Set certificate trust policy to trust self-signed certificates (<span style="color: #0000ff">for</span> test servers).</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #008000">#&gt;</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #008000">## Code From https://poshcode.org/624</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    <span style="color: #008000">## Create a compilation environment</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $Provider=New-Object Microsoft.CSharp.CSharpCodeProvider</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $Compiler=$Provider.CreateCompiler()</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $Params=New-Object System.CodeDom.Compiler.CompilerParameters</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $Params.GenerateExecutable=$False</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $Params.GenerateInMemory=$True</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $Params.IncludeDebugInformation=$False</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $Params.ReferencedAssemblies.Add(<span style="color: #006080">"System.DLL"</span>) | Out-Null</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $TASource=@<span style="color: #006080">'</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        namespace Local.ToolkitExtensions.Net.CertificatePolicy {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        public class TrustAll : System.Net.ICertificatePolicy {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            public TrustAll()</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            { </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">            public bool CheckValidationResult(System.Net.ServicePoint sp,</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">                                                System.Security.Cryptography.X509Certificates.X509Certificate cert, </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">                                                System.Net.WebRequest req, int problem)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">                return true;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">            }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">        }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">'</span>@ </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    $TAAssembly=$TAResults.CompiledAssembly</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #008000">## We now create an instance of the TrustAll and attach it to the ServicePointManager</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $TrustAll=$TAAssembly.CreateInstance(<span style="color: #006080">"Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll"</span>)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    [System.Net.ServicePointManager]::CertificatePolicy=$TrustAll</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">}</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000"># The following is the main script</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># Check if we need to ignore any certificate errors</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000"># This needs to be done *before* the managed API is loaded, otherwise it doesn't work consistently (i.e. usually doesn't!)</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #0000ff">if</span> ($IgnoreSSLCertificate)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">{</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    Write-Host <span style="color: #006080">"WARNING: Ignoring any SSL certificate errors"</span> -foregroundColor Yellow</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    TrustAllCerts</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">}</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># Load EWS Managed API</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #0000ff">if</span> (!(LoadEWSManagedAPI))</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">{</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    Write-Host <span style="color: #006080">"Failed to locate EWS Managed API, cannot continue"</span> -ForegroundColor $error</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    Exit</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">}</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"><span style="color: #008000">#Create the service Object.</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP1)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"><span style="color: #008000"># Set credentials if specified, or use logged on user.</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"> <span style="color: #0000ff">if</span> ($AuthUsername -and $AuthPassword)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"> {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    Write-Host <span style="color: #006080">"Applying given Credentials for:"</span>, $AuthUsername -ForegroundColor $info</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    <span style="color: #0000ff">if</span> ($AuthDomain)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        $service.Credentials = New-Object  Microsoft.Exchange.WebServices.Data.WebCredentials($AuthUsername,$AuthPassword,$AuthDomain)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    } <span style="color: #0000ff">else</span> {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">        $service.Credentials = New-Object  Microsoft.Exchange.WebServices.Data.WebCredentials($AuthUsername,$AuthPassword)</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">} <span style="color: #0000ff">else</span> {</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">    Write-Host <span style="color: #006080">"Using default credentials"</span> -ForegroundColor Gray</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">    $service.UseDefaultCredentials = $true</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white"> }</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4"> </pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">&nbsp;</pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: #f4f4f4">Write-Host <span style="color: #006080">""</span></pre><!--CRLF--><pre style="border-top-style: none;font-size: 8pt;overflow: visible;border-left-style: none;font-family: 'Courier New', courier, monospace;width: 100%;border-bottom-style: none;color: black;padding-bottom: 0px;direction: ltr;text-align: left;padding-top: 0px;border-right-style: none;padding-left: 0px;margin: 0em;line-height: 12pt;padding-right: 0px;background-color: white">SearchOrganizationalFormsLibrary</pre><!--CRLF--></div></div>
<p>By default the script will generate a .reg file for 32 bit Outlook on 64 bit Windows. If you want it for 64 bit Outlook on 64 bit Windows or 32 bit Outlook on 32 bit Windows, just specify -Bitness “x64on64” or -Bitness “x32on32”&nbsp; in the command like below (technically an value other than “x32on64” will work).&nbsp; <p>Sample command line below: 
<p>.\DumpMessageClassforForms.ps1 -AuthUsername admin –AuthPassword Pa$$w0rd –AuthDomain contoso -EwsUrl <a href="https://ex2013.contoso.com/ews/exchange.asmx">https://ex2013.contoso.com/ews/exchange.asmx</a> <br>-IgnoreSSLCertificate 
<p>The registry file will be generated in the same folder where the script is run from. 
<p>Enjoy!]]></content:encoded>
    </item>
    <item>
      <title>Generating a report - Which folders have a Personal Tag applied to it (using EWS Managed API from PowerShell - Exchange 2010)</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/generating-a-report-which-folders-have-a-personal-tag-applied-to-it-using-ews-managed-api-from-powershell-exchange-2010</link>
      <pubDate>Thu, 13 Jun 2013 13:49:48 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2013/06/13/generating-a-report-which-folders-have-a-personal-tag-applied-to-it-using-ews-managed-api-from-powershell-exchange-2010/</guid>
      <description><![CDATA[It’s time to do a bit of reporting!  In my previous posts I have talked about Stamping Archive...]]></description>
      <content:encoded><![CDATA[<p>It’s time to do a bit of reporting!</p>  <p>In my previous posts I have talked about Stamping <a href="https://blogs.msdn.com/b/akashb/archive/2012/12/07/stamping-archive-policy-tag-using-ews-managed-api-from-powershell-exchange-2010.aspx" target="_blank">Archive Policy Tag</a>, <a href="https://blogs.msdn.com/b/akashb/archive/2012/01/12/stamping-retention-policy-tag-on-items-using-ews-managed-api-1-1-from-powershell-exchange-2010-part-2.aspx" target="_blank">Retention Policy Tag on Items</a>, <a href="https://blogs.msdn.com/b/akashb/archive/2011/08/11/stamping-retention-policy-tag-using-ews-managed-api-1-1-from-powershell-exchange-2010.aspx" target="_blank">Retention Policy Tag on Folders</a> but this time the requirement was different! In this case we wanted to scan the entire mailbox and find out the folders that have a Personal Tag applied to it.</p>  <p>To summarize what the script below does:</p>  <ul>   <li>We search the entire mailbox and look for folders that have a Folder class of IPF.Note </li>    <li>Loop through the folders and write out the Folder Path, Retention Policy Tag GUID and the Retention Period </li>    <li>The log can then be opened in Excel and manipulated in any way you like! </li> </ul>  <p>Straight to code now. Create a .PS1 file with the code below:    <br />    <br /></p>  <div id="codeSnippetWrapper">   <pre id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: &#39;Courier New&#39;, courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><p><span style="color: #008000"># The script requires the EWS managed API, which can be downloaded here:</span><br /><span style="color: #008000"># https://www.microsoft.com/en-us/download/details.aspx?id=35371</span><br /><span style="color: #008000"># This also requires PowerShell 2.0</span><br /><span style="color: #008000"># Make sure the Import-Module command below matches the DLL location of the API.</span><br /><span style="color: #008000"># This path must match the install location of the EWS managed API. Change it if needed.</span></p><p>[string]$info = <span style="color: #006080">&quot;White&quot;</span>                <span style="color: #008000"># Color for informational messages</span><br />[string]$warning = <span style="color: #006080">&quot;Yellow&quot;</span>            <span style="color: #008000"># Color for warning messages</span><br />[string]$error = <span style="color: #006080">&quot;Red&quot;</span>                <span style="color: #008000"># Color for error messages</span><br />[string]$LogFile = <span style="color: #006080">&quot;C:\Temp\Log.csv&quot;</span> <span style="color: #008000"># Path of the Log File</span></p><p><span style="color: #0000ff">function</span> SearchFolders($MailboxName)<br />{<br />    Write-host <span style="color: #006080">&quot;Searching folders in Mailbox Name:&quot;</span> $MailboxName -foregroundcolor  $info<br />    <br />    <span style="color: #008000">#Change the user to Impersonate</span><br />    $service.ImpersonatedUserId = new-object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress,$MailboxName);</p><p>    <span style="color: #008000">#Number of Items to Get<br /></span>    $FpageSize =50<br />    $FOffset = 0<br />    $MoreFolders =$true</p><p>    <span style="color: #0000ff">while</span> ($MoreFolders)<br />     {<br /><br />        <span style="color: #008000">#Setup the View to get a limited number of Items at one time</span><br />        $folderView = new-object Microsoft.Exchange.WebServices.Data.FolderView($FpageSize,$FOffset,[Microsoft.Exchange.WebServices.Data.OffsetBasePoint]::Beginning)<br />        $folderView.Traversal = [Microsoft.Exchange.WebServices.Data.FolderTraversal]::Deep<br />        <br />        <span style="color: #008000"># Folder Path</span><br />        $PR_FOLDER_PATH = new-object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(26293, [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::String);</p><p>        <span style="color: #008000">#PR_POLICY_TAG 0x3019</span><br />        $PolicyTag = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3019,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Binary);</p><p>        <span style="color: #008000">#PR_RETENTION_FLAGS 0x301D    </span><br />        $RetentionFlags = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x301D,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Integer);<br />        <br />        <span style="color: #008000">#PR_RETENTION_PERIOD 0x301A</span><br />        $RetentionPeriod = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x301A,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Integer);<br /><br />        $FPropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet(<br />                            [Microsoft.Exchange.WebServices.Data.BasePropertySet]::IdOnly,<br />                            [Microsoft.Exchange.WebServices.Data.FolderSchema]::DisplayName,<br />                            [Microsoft.Exchange.WebServices.Data.FolderSchema]::FolderClass);<br />                            <br />        $FPropertySet.Add($PR_FOLDER_PATH);  <br />        $FPropertySet.Add($PolicyTag);<br />        $FPropertySet.Add($RetentionPeriod);<br />        <br />        $folderView.PropertySet = $FPropertySet;<br />        <br />        <span style="color: #008000">#Create the Search Filter.</span><br />        $FoSearchFilter = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.FolderSchema]::FolderClass, <span style="color: #006080">&quot;IPF.Note&quot;</span>)<br /><br />        $oFindFolders = $service.FindFolders([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot,$FoSearchFilter,$folderView)<br />        <br />        $PolicyTagString = $null;<br />        <br />        <span style="color: #0000ff">foreach</span> ($folder <span style="color: #0000ff">in</span> $oFindFolders.Folders)<br />        {<br />            Write-host <span style="color: #006080">&quot;Looking at Folder:&quot;</span> $folder.ExtendedProperties[0].Value  -foregroundcolor $info;<br />      <br />            &amp;{<br />                <span style="color: #0000ff">if</span> ($folder.ExtendedProperties[1].Value <span style="color: #cc6633">-ne</span> $null)<br />                {<br />                    $byteA =[byte[]]($folder.ExtendedProperties[1].Value)<br />                    $PolicyTagGUID = new-Object Guid(,$byteA);<br />                    $PolicyTagString = $PolicyTagGUID.ToString();<br />                }<br />                Add-Content $LogFile ($MailboxName + <span style="color: #006080">&quot;,&quot;</span> +$folder.ExtendedProperties[0].Value +<span style="color: #006080">&quot;,&quot;</span> +$PolicyTagString+<span style="color: #006080">&quot;,&quot;</span> +$folder.ExtendedProperties[2].Value);<br />            }<br />            <span style="color: #0000ff">trap</span> [System.Exception] <br />            {<br />                Write-host (<span style="color: #006080">&quot;Error: &quot;</span> + $_.Exception.Message) -foregroundcolor $error;<br />                <span style="color: #0000ff">continue</span>;<br />            }<br />        }<br /><br />         <span style="color: #0000ff">if</span> ($oFindFolders.MoreAvailable <span style="color: #cc6633">-eq</span> $false)<br />            {$MoreFolders = $false}<br /><br />             <span style="color: #0000ff">if</span> ($MoreFolders)<br />            {$FOffset += $FpageSize}<br />        <br />     }<br /><br />    Write-host <span style="color: #006080">&quot;Finished with Mailbox Name:&quot;</span> $MailboxName <span style="color: #006080">&quot;Done!&quot;</span> -foregroundcolor  $info<br />    Write-host <span style="color: #006080">&quot;-------------------------------------------------&quot;</span> -foregroundcolor  $info<br /><br />    $service.ImpersonatedUserId = $null<br />}</p><p>Import-Module -Name <span style="color: #006080">&quot;C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll&quot;</span></p><p>$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP1)</p><p><span style="color: #008000"># Set the Credentials</span><br />$service.Credentials = new-object Microsoft.Exchange.WebServices.Data.WebCredentials(<span style="color: #006080">&quot;ServiceAccount&quot;</span>,<span style="color: #006080">&quot;password&quot;</span>,<span style="color: #006080">&quot;domain&quot;</span>)</p><p><span style="color: #008000"># Change the URL to point to your cas server</span><br />$service.Url= new-object Uri(&quot;<span style="color: #006080">https://Your-CAS-Server/EWS/Exchange.asmx&quot;</span>)</p><p><span style="color: #008000"># Set $UseAutoDiscover to $true if you want to use AutoDiscover else it will use the URL set above</span><br />$UseAutoDiscover = $false</p><p><span style="color: #008000"># Add headers to the log file</span><br />Add-Content $LogFile (<span style="color: #006080">&quot;Mailbox&quot;</span> + <span style="color: #006080">&quot;,&quot;</span> +<span style="color: #006080">&quot;Folder Path&quot;</span> +<span style="color: #006080">&quot;,&quot;</span> +<span style="color: #006080">&quot; Retention Tag GUID&quot;</span> +<span style="color: #006080">&quot;,&quot;</span> +<span style="color: #006080">&quot;Retention Period&quot;</span>);</p><p><span style="color: #008000">#Read data from the UserAccounts.txt</span><br />import-csv UserAccounts.txt | <span style="color: #0000ff">foreach</span>-object {<br />    $WindowsEmailAddress = $_.WindowsEmailAddress.ToString()<br /><br />    <span style="color: #0000ff">if</span> ($UseAutoDiscover <span style="color: #cc6633">-eq</span> $true) {<br />        Write-host <span style="color: #006080">&quot;Autodiscovering..&quot;</span> -foregroundcolor $info<br />        $UseAutoDiscover = $false<br />        $service.AutodiscoverUrl($WindowsEmailAddress)<br />        Write-host <span style="color: #006080">&quot;Autodiscovering Done!&quot;</span> -foregroundcolor $info<br />        Write-host <span style="color: #006080">&quot;EWS URL set to :&quot;</span> $service.Url -foregroundcolor $info<br /><br />    }<br />    <span style="color: #008000">#To catch the Exceptions generated</span><br />    <span style="color: #0000ff">trap</span> [System.Exception] <br />    {<br />        Write-host (<span style="color: #006080">&quot;Error: &quot;</span> + $_.Exception.Message) -foregroundcolor $error;<br />        Add-Content $LogFile (<span style="color: #006080">&quot;Error: &quot;</span> + $_.Exception.Message);<br />        <span style="color: #0000ff">continue</span>;<br />    }<br />    SearchFolders($WindowsEmailAddress)<br />}    </p></pre>

  <br /></div>

<p>UserAccounts.txt contains the list of the users mailboxes that need to be searched. This file should exist in the same directory as the .PS1 file.The First row denotes the Field Names. Format of the text file is as below: </p>

<div id="codeSnippetWrapper">
  <pre id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: &#39;Courier New&#39;, courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4">WindowsEmailAddress<br />akasha@contoso.com<br />akashb@contoso.com<br />akashc@contoso.com</pre>

  <br /></div>

<pre><font face="Arial">To Run the script: <br />1)Open the Exchange Management Shell <br />2)Navigate to the location where the script file is. <br />3)Type in .\ScriptName.PS1 and hit enter to execute the script <br />Note: This script creates a log file in C:\Temp. Make sure that directory exists.</font></pre>

<pre><font face="Arial">Below is what the log file will look like:</font></pre>

<pre><pre id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: &#39;Courier New&#39;, courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4">Mailbox,Folder Path, Retension Tag GUID,Retension Period<br />akasha@contoso.com,\Deleted Items,,<br />akasha@contoso.com,\Drafts,,<br />akasha@contoso.com,\Inbox,,<br />akasha@contoso.com,<font style="background-color: #ffff00">\Inbox\Inbox1</font>,<font style="background-color: #ffff00">4528ac9a-35b6-454d-96cb-c6801795bbce</font>,300<br />akasha@contoso.com,<font style="background-color: #ffff00">\Inbox\Inbox1\Inbox2</font>,<font style="background-color: #ffff00">4528ac9a-35b6-454d-96cb-c6801795bbce</font>,300<br />akasha@contoso.com,\Junk E-Mail,,<br />akasha@contoso.com,\Outbox,,<br />akasha@contoso.com,\Sent Items,,<br />akasha@contoso.com,<font style="background-color: #ffff00">\Test</font>,<font style="background-color: #ffff00">4528ac9a-35b6-454d-96cb-c6801795bbce</font>,300<br />akashb@contoso.com,\Deleted Items,,<br />akashb@contoso.com,\Drafts,,<br />akashb@contoso.com,\Inbox,,<br />akashb@contoso.com,\Inbox\1,,<br />akashb@contoso.com,\Junk E-Mail,,<br />akashb@contoso.com,\Outbox,,<br />akashb@contoso.com,\Sent Items,,</pre></pre>

<pre><font face="Arial">Note the Folder Path and the GUID. What is this GUID? This is the Retention Policy Tag GUID!</font></pre>

<pre><font face="Arial">Where can I get it from?</font></pre>

<pre><font face="Arial">Open up Exchange Management Shell and run the command below:</font></pre>

<pre><font face="Arial">[PS] C:\&gt;Get-RetentionPolicyTag | FL Name,GUID</font></pre>

<pre><font face="Arial">Output:</font></pre>

<pre><div id="codeSnippetWrapper"><pre id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: &#39;Courier New&#39;, courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><p>Name : Personal 1 Year move <span style="color: #0000ff">to</span> archive<br />Guid : 797921d5-5c63-4a7b-b5d0-31e57a48f71b<br />Name : 1 Year Delete<br />Guid : 82139a14-cbf8-4467-9324-1c95c91bc12a<br />Name : Corp-BusinessCritical<br />Guid : 92186ff7-7f4d-4efa-a09b-bbdc5aee3908<br />Name : 100 Days - Delete<br />Guid : 3b7f5e7a-9016-4f87-a829-83f84c5adc62<br />Name : 300 Days Delete<br />Guid : <font style="background-color: #ffff00">4528ac9a-35b6-454d-96cb-c6801795bbce</font></p></pre><br /></div><br /><font face="Arial">Now you know which Policy Tag was applied to the folder. Enjoy!</font><br /><br /></pre>]]></content:encoded>
    </item>
    <item>
      <title>All I know about Outlook 2010/2013 and SharePoint Synchronization</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/all-i-know-about-outlook-20102013-and-sharepoint-synchronization</link>
      <pubDate>Fri, 05 Apr 2013 08:50:13 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2013/04/05/all-i-know-about-outlook-20102013-and-sharepoint-synchronization/</guid>
      <description><![CDATA[When does Outlook 2010/2013 synchronies SharePoint Lists and Document Libraries?  By default,...]]></description>
      <content:encoded><![CDATA[<p><b></b></p>  <p><b>     <br /><font size="3">When does Outlook 2010/2013 synchronies SharePoint Lists and Document Libraries?</font></b></p>  <p>By default, WSS lists can be synchronized once during each Send/Receive interval, and there are four basic ways to initiate this Send/Receive process in Outlook:</p>  <p>· Send/Receive (automatic or manual)   <br />· Shift+F9 or F9    <br />· Folder focus change    <br />· Synchronize when Saving/Updating an Item</p>  <p>The All Accounts Send/Receive group has SharePoint list synchronization enabled by default and an automatic send/receive interval of 30 minutes. If you want to customize the default Send/Receive settings for your Outlook profile, Click on Send/Receive Tab, Click on Send/Receive Groups and then click Define Send/Receive Groups. The Send/Receive Groups dialog box is displayed.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/2626.clip_image001_7E3B804C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/2626.clip_5F00_image001_5F00_7E3B804C.png"><img title="clip_image001" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/7713.clip_image001_thumb_7C1E8183.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/7713.clip_5F00_image001_5F00_thumb_5F00_7C1E8183.png" width="419" height="475" /></a></p>  <p>Then, in the Send/Receive Groups dialog box select the All Accounts group and click Edit.The Send/Receive Settings – All Accounts dialog box is displayed.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/8484.All-Accounts_2F0E11EB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/8484.All_2D00_Accounts_5F00_2F0E11EB.png"><img title="All Accounts" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="All Accounts" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/3107.All-Accounts_thumb_1F1ECD27.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/3107.All_2D00_Accounts_5F00_thumb_5F00_1F1ECD27.png" width="607" height="507" /></a></p>  <p>The Send/Receive Settings – All Accounts dialog box contains two settings related to SharePoint list synchronization.</p>  <p>· <b>Include Windows SharePoint lists in this Send/Receive group</b> - With this checkbox enabled, every time the Send/Receive process is initiated for the Send/Receive group, the enabled SharePoint lists may be synchronized (<b><i>depending on the Send/Receive update setting and the WSS automatic synchronization limit</i></b>). If this checkbox is not enabled, then your SharePoint lists are not synchronized with Outlook during a Send/Receive operation. In this situation, you have to use different method for synchronizing the data.</p>  <p>· <b>Send/Receive Options</b> - Every SharePoint list configured on the SharePoint Lists tab of the Account Settings dialog box is listed under Send/Receive Options in the Send/Receive Settings – All Accounts dialog box. Only lists whose checkbox is enabled are synchronized whenever the synchronization process for the parent Send/Receive group is initiated.</p>  <p><b>Automatic Send/Receive Synchronization     <br /></b>In the Send/Receive Groups dialog box is a setting for All Accounts called Schedule an automatic send/receive every x minutes. When this x-minute interval expires, Outlook performs an automatic send/receive operation based on the settings you have configured for the All Accounts group in the Send/Receive Settings – All Accounts dialog box. If you disable SharePoint list synchronization via the Include Windows SharePoint lists in this Send/Receive group checkbox, or synchronization of specific SharePoint lists via the Send/Receive Options checkbox for the lists, then an automatic send/receive operation does not synchronize the WSS lists.</p>  <p><b>Manual Send/Receive Synchronization     <br /></b>There are several ways to perform a manual send/receive operation.</p>  <p>· Press F9   <br />· Click Send/Receive All Folders on the Send/Receive Tab</p>  <p>If you have SharePoint synchronization enabled, then your SharePoint list should be synchronized whenever you use one of these manual send/receive operations.</p>  <p>If you disable SharePoint list synchronization via the Include Windows SharePoint lists in this Send/Receive group checkbox or you disable synchronization of specific SharePoint lists via the Send/Receive Options checkboxes, then your SharePoint lists are not synchronized when you use one of these manual send/receive operations. This occurs because these methods honor the settings you specify for the Send/Receive group.</p>  <p><b>Shift + F9     <br /></b>Using Shift+F9 is not technically classified as a Send/Receive operation because it does not utilize the settings you have for your Send/Receive group(s). Even if you disable SharePoint list synchronization via the Include Windows SharePoint lists in this Send/Receive group checkbox or synchronization of specific SharePoint lists via the Send/Receive Options checkboxes, your SharePoint list for the selected folder is still synchronized.</p>  <p>To initiate a manual synchronization of a SharePoint List folder, use the following steps.</p>  <p>· Select the folder for the WSS list or document library in the Folder List module.   <br />· Press Shift + F9</p>  <p><b>Folder Focus Change     <br /></b>A third method of synchronizing a SharePoint list is to click off the folder for the list and then click back to it. This is another useful method if you disabled SharePoint list synchronization via the Include Windows SharePoint lists in this Send/Receive group checkbox or synchronization of specific SharePoint lists via the Send/Receive Options checkbox for the lists.</p>  <p><b>Synchronize when Saving an Item     <br /></b>To make collaboration a good user experience, Outlook automatically synchronizes your list if you add or edit a list item within the Outlook interface. Outlook does not wait for an automatic synchronization or a manual synchronization in this scenario and it only respects the server’s TTL value(We will look at what this is later in the article).<s></s></p>  <p><b><font size="3">Does the STSSyncInterval registry key for Outlook control synchronization on Outlook 2010/2013?</font></b></p>  <p><b></b></p>  <p>The <strong>STSSyncInterval</strong> regkey corresponds to the &quot;SharePoint folder sync interval&quot; GPO which is included by default in the Outlook 2010/2013 adm template.</p>  <p><b><i>Although this is present, it is no longer used by Outlook</i></b><i>.</i></p>  <p><b><font size="3">How can we control the frequency of synchronization?</font></b></p>  <p>The Outlook client makes a call to the SharePoint Server to returns changes made to the specified list since the date and time specified in the token, if specified, or to return all the list items in the list. It uses the GetListItemChangesSinceToken operation. More details can be found in the article below:</p>  <p>Lists.GetListItemChangesSinceToken method   <br /><a href="https://msdn.microsoft.com/en-us/library/websvclists.lists.getlistitemchangessincetoken.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/websvclists.lists.getlistitemchangessincetoken.aspx</a></p>  <p>The following example shows a request that uses the change token extracted from a previous GetListItemChangesSinceTokenResponse:   <br /></p>  <p id="codeSnippetWrapper">   <pre id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: &#39;Courier New&#39;, courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">=&quot;1.0&quot;</span> <span style="color: #ff0000">encoding</span><span style="color: #0000ff">=&quot;utf-8&quot;</span>?<span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;</span><span style="color: #800000">soap:Envelope</span> <span style="color: #ff0000">xmlns:xsi</span><span style="color: #0000ff">=&quot;https://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #ff0000">xmlns:xsd</span><span style="color: #0000ff">=&quot;https://www.w3.org/2001/XMLSchema&quot;</span> <span style="color: #ff0000">xmlns:soap</span><span style="color: #0000ff">=&quot;https://schemas.xmlsoap.org/soap/envelope/&quot;</span><span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;</span><span style="color: #800000">soap:Body</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;</span><span style="color: #800000">GetListItemChangesSinceToken</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;https://schemas.microsoft.com/sharepoint/soap/&quot;</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;</span><span style="color: #800000">listName</span><span style="color: #0000ff">&gt;</span>TestListItem<span style="color: #0000ff">&lt;/</span><span style="color: #800000">listName</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;</span><span style="color: #800000">query</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">Query</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">OrderBy</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">FieldRef</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;ID&quot;</span><span style="color: #0000ff">/&gt;&lt;/</span><span style="color: #800000">OrderBy</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">Query</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">query</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;</span><span style="color: #800000">viewFields</span><span style="color: #0000ff">&gt;</span><br />            <span style="color: #0000ff">&lt;</span><span style="color: #800000">ViewFields</span><span style="color: #0000ff">&gt;</span><br />                <span style="color: #0000ff">&lt;</span><span style="color: #800000">FieldRef</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;ID&quot;</span> <span style="color: #0000ff">/&gt;&lt;</span><span style="color: #800000">FieldRef</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;Title&quot;</span> <span style="color: #0000ff">/&gt;</span><br />            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">ViewFields</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;/</span><span style="color: #800000">viewFields</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;</span><span style="color: #800000">rowLimit</span><span style="color: #0000ff">&gt;</span>10<span style="color: #0000ff">&lt;/</span><span style="color: #800000">rowLimit</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;</span><span style="color: #800000">changeToken</span><span style="color: #0000ff">&gt;</span> 1;3;e074e60a-0126-4446-a751-a5be7a55ed81;633374187828130000;243<span style="color: #0000ff">&lt;/</span><span style="color: #800000">changeToken</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">GetListItemChangesSinceToken</span><span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;/</span><span style="color: #800000">soap:Body</span><span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;/</span><span style="color: #800000">soap:Envelope</span><span style="color: #0000ff">&gt;</span><br /> <br /> <br /></pre>
</p>

<p>The response we get:
  <br />

  <div id="codeSnippetWrapper">
    <pre id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: &#39;Courier New&#39;, courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"><span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">=&quot;1.0&quot;</span> <span style="color: #ff0000">encoding</span><span style="color: #0000ff">=&quot;utf-8&quot;</span>?<span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;</span><span style="color: #800000">soap:Envelope</span> <span style="color: #ff0000">xmlns:soap</span><span style="color: #0000ff">=&quot;https://schemas.xmlsoap.org/soap/envelope/&quot;</span> <span style="color: #ff0000">xmlns:xsi</span><span style="color: #0000ff">=&quot;https://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #ff0000">xmlns:xsd</span><span style="color: #0000ff">=&quot;https://www.w3.org/2001/XMLSchema&quot;</span><span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;</span><span style="color: #800000">soap:Body</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;</span><span style="color: #800000">GetListItemChangesSinceTokenResponse</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;https://schemas.microsoft.com/sharepoint/soap/&quot;</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;</span><span style="color: #800000">GetListItemChangesSinceTokenResult</span><span style="color: #0000ff">&gt;</span><br />            <span style="color: #0000ff">&lt;</span><span style="color: #800000">listitems</span> <font style="background-color: #ffff00"><span style="color: #ff0000">MinTimeBetweenSyncs</span><span style="color: #0000ff">='0'</span></font> <font style="background-color: #ffff00"><span style="color: #ff0000">RecommendedTimeBetweenSyncs</span><span style="color: #0000ff">='180'</span></font> <span style="color: #ff0000">MaxBulkDocumentSyncSize</span><span style="color: #0000ff">='500'</span> <span style="color: #ff0000">AlternateUrls</span><span style="color: #0000ff">='https://siteaddress/'</span> <span style="color: #ff0000">EffectivePermMask</span><span style="color: #0000ff">='FullMask'</span> <br />            <span style="color: #ff0000">xmlns:s</span><span style="color: #0000ff">='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'</span> <span style="color: #ff0000">xmlns:dt</span><span style="color: #0000ff">='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'</span> <span style="color: #ff0000">xmlns:rs</span><span style="color: #0000ff">='urn:schemas-microsoft-com:rowset'</span> <span style="color: #ff0000">xmlns:z</span><span style="color: #0000ff">='#RowsetSchema'</span><span style="color: #0000ff">&gt;</span> <br />            <span style="color: #0000ff">&lt;</span><span style="color: #800000">Changes</span> <span style="color: #ff0000">LastChangeToken</span><span style="color: #0000ff">=&quot;1;3;e074e60a-0126-4446-a751-a5be7a55ed81;633374187828130000;243&quot;</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">List</span> <span style="color: #ff0000">excluded</span> <span style="color: #ff0000">content</span> <span style="color: #ff0000">that</span> <span style="color: #ff0000">matches</span> <span style="color: #ff0000">GetList</span> <span style="color: #ff0000">call</span> … <span style="color: #0000ff">&gt;</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">List</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">Changes</span><span style="color: #0000ff">&gt;</span> <br />                <span style="color: #0000ff">&lt;</span><span style="color: #800000">rs:data</span> <span style="color: #ff0000">ItemCount</span><span style="color: #0000ff">=&quot;1&quot;</span><span style="color: #0000ff">&gt;</span> <br />                    <span style="color: #0000ff">&lt;</span><span style="color: #800000">z:row</span> <span style="color: #ff0000">ows_ID</span><span style="color: #0000ff">='1'</span> <span style="color: #ff0000">ows_Title</span><span style="color: #0000ff">='Test new entry'</span> <span style="color: #ff0000">ows_MetaInfo</span><span style="color: #0000ff">='1;#'</span> <span style="color: #ff0000">ows__ModerationStatus</span><span style="color: #0000ff">='0'</span> <span style="color: #ff0000">ows__Level</span><span style="color: #0000ff">='1'</span> <span style="color: #ff0000">ows_owshiddenversion</span><span style="color: #0000ff">='3'</span> <span style="color: #ff0000">ows_UniqueId</span><span style="color: #0000ff">='1;#{078CAB5C-5FEA-43EA-B23A-FB93EF35397D}'</span> <br />                    <span style="color: #ff0000">ows_FSObjType</span><span style="color: #0000ff">='1;#0'</span> <span style="color: #ff0000">ows_Created</span><span style="color: #0000ff">='2008-01-28 08:06:11'</span> <span style="color: #ff0000">ows_FileRef</span><span style="color: #0000ff">='1;#Lists/TestListItem/1_.000'</span> <span style="color: #0000ff">/&gt;</span><br />                <span style="color: #0000ff">&lt;/</span><span style="color: #800000">rs:data</span><span style="color: #0000ff">&gt;</span><br />            <span style="color: #0000ff">&lt;/</span><span style="color: #800000">listitems</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;/</span><span style="color: #800000">GetListItemChangesSinceTokenResult</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">GetListItemChangesSinceTokenResponse</span><span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;/</span><span style="color: #800000">soap:Body</span><span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;/</span><span style="color: #800000">soap:Envelope</span><span style="color: #0000ff">&gt;</span><br /></pre>

    <br />Notice the <font style="background-color: #ffff00">MinTimeBetweenSyncs</font> and the <font style="background-color: #ffff00">RecommendedTimeBetweenSyncs</font> values returned, these values are used to control how synchronization works in Outlook.</div>
</p>

<pre><font face="Arial">By default, a SharePoint list does not have a publishing limit configured and the Current provider limit value in the SharePoint List Options dialog box will show Not Published. Therefore, by default, you can manually synchronize your WSS list data with Outlook as often as you want. </font></pre>

<pre><font face="Arial">Where can I see this in the Outlook UI? </font><font face="Arial">You can go to Account Settings, then to the SharePoint Lists Tab and then double click on the list you are interested in.</font></pre>

<pre><font face="Arial"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/8054.xxx_7CE6C1A0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/8054.xxx_5F00_7CE6C1A0.png"><img title="xxx" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="xxx" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/8865.xxx_thumb_2FD65208.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/8865.xxx_5F00_thumb_5F00_2FD65208.png" width="719" height="454" /></a></font></pre>

<pre><font face="Arial">The <b>MinTimeBetweenSyncs</b> represents the minimum amount of time between user-initiated or automatic synchronization. The value represents a time in minutes.</font></pre>

<p><i>Clients should respect this value even if the user initiates synchronization manually. That is, if this is set to 5 minutes, clients should only send one request per 5 minutes even if the user repeatedly clicks &quot;send/receive&quot;. 
    <br />

    <br /></i>This setting is also known TTL and the property name that needs to be set on the SharePoint server is “min-time-between-syncs”. The default value for this property is 0 minutes. How do we set it on the SharePoint Server?</p>

<pre><font face="Arial">To set this value on the server, use the STSADM interface on the SharePoint server. The general syntax for setting a property is:</font></pre>

<pre><font face="Arial">stsadm -o setproperty –propertyname &lt;property name&gt; -propertyvalue &lt;property value&gt;</font></pre>

<pre><font face="Arial">So in this case:</font></pre>

<pre><font face="Arial">STSADM -o setproperty - propertyname &quot;min-time-between-syncs&quot; - propertyvalue &quot;0&quot;</font></pre>

<pre><font face="Arial">Users can prevent their clients from honoring the TTL value you specify by clearing the Update Limit checkbox in the SharePoint List Options dialog box for a list. However, you can also set policy key to force Outlook clients to respect the TTL value published by WSS.</font></pre>

<pre><font face="Arial">The policy is called “Override published sync interval”.</font></pre>

<p><strong>Registry Key:</strong> software\policies\microsoft\office\14.0\outlook\options\wss

  <br /><strong>Registry Value Name:</strong>IgnoreTTL

  <br /><strong>Registry Value:</strong> 1 or 0

  <br /><strong>Description:</strong> This policy setting allows you to prevent users from overriding the sync interval published by managed SharePoint lists. If you enable this policy setting, the ''Update Limit'' checkbox found under File tab | Info | Account Settings | SharePoint List | Change&amp; is disabled, and the user's connected SharePoint lists will only sync as defined by the list's administrator. If you disable this policy setting, then individual users will be able to override the sync interval by unchecking the ''Update Limit'' checkbox in the SharePoint List's Options dialog.</p>

<pre><font face="Arial">However, there is a different server synchronization limit that is used for <b><i>automatic synchronizations initiated by an Outlook Send/Receive operation</i></b>. The default limit for automatic synchronizations by Outlook is 180 minutes.</font></pre>

<pre><font face="Arial">This setting is also known ASI and the property name that needs to be set on the SharePoint server is “recommended-time-between-syncs”. The default value for this property is 180. How do we set it on the SharePoint Server?</font></pre>

<pre><font face="Arial">To set this value on the server, use the STSADM interface on the SharePoint server. The general syntax for setting a property is:</font></pre>

<pre><font face="Arial">stsadm -o setproperty –propertyname &lt;property name&gt; -propertyvalue &lt;property value&gt;</font></pre>

<pre><font face="Arial">So in this case:</font></pre>

<pre><font face="Arial">STSADM -o setproperty - propertyname &quot;recommended-time-between-syncs&quot; - propertyvalue &quot;60&quot;</font></pre>

<pre><font face="Arial">When the “recommended-time-between-syncs” is set on the server, Outlook will synchronize the lists once in 60 minutes(as set in the example above) even when automatic synchronizations is scheduled to happen in 30 minutes by default.</font></pre>

<pre><font face="Arial">If users synchronize too often with the SharePoint server or they complain that the automatic synchronization interval is too long, you can adjust the ASI and the TTL values on the server to better suit the needs of your users. </font></pre>

<pre><font face="Arial">Enjoy!</font></pre>]]></content:encoded>
    </item>
    <item>
      <title>Images sent using Snipping Tool(SnippingTool.exe) shows up as RED X in Outlook 2010</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/images-sent-using-snipping-toolsnippingtool-exe-shows-up-as-red-x-in-outlook-2010</link>
      <pubDate>Fri, 07 Dec 2012 14:09:04 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2012/12/07/images-sent-using-snipping-toolsnippingtool-exe-shows-up-as-red-x-in-outlook-2010/</guid>
      <description><![CDATA[This was an interesting issue, the customer was using the Snipping Tool to capture images and mail...]]></description>
      <content:encoded><![CDATA[<p>This was an interesting issue, the customer was using the Snipping Tool to capture images and mail them. He would simply get a capture and then do a File-&gt;Send To-&gt; E-mail Recipient in the Snipping Tool, this opened an E-mail in Outlook and everything looked fine. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/5383.image_5FB26DFE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/5383.image_5F00_5FB26DFE.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/0020.image_thumb_6DC1372E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/0020.image_5F00_thumb_5F00_6DC1372E.png" width="554" height="300" /></a></p>  <p>When the email was sent and received, the Image showed up as a Red X with the message “The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location.”</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/6545.image_2B6E1EEB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/6545.image_5F00_2B6E1EEB.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/6545.image_thumb_3148C284.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/6545.image_5F00_thumb_5F00_3148C284.png" width="554" height="229" /></a></p>    <p>An Interesting fact was that this worked fine in the following scenarios:   <br />1) When Outlook was run in Safe mode    <br />2) If the image was copied and pasted in the e-mail instead of using the Snipping Tool</p>  <p>We look at the HTML of the email and noticed that the img tag was pointing to a physical path to the Image file! This is never going to work since the same path+Image would never exist on the recipients machine. Below is what the body looked like:   <br />    <div id="codeSnippetWrapper">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span> <span style="color: #ff0000">lang</span>=<span style="color: #ff0000">EN-US</span> <span style="color: #ff0000">link</span>=<span style="color: #ff0000">blue</span> <span style="color: #ff0000">vlink</span>=<span style="color: #ff0000">purple</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;</span><span style="color: #800000">div</span> <span style="color: #ff0000">class</span>=<span style="color: #ff0000">WordSection1</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">p</span> <span style="color: #ff0000">class</span>=<span style="color: #ff0000">MsoNormal</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;</span><span style="color: #800000">span</span> <span style="color: #ff0000">style</span><span style="color: #0000ff">='font-family:&quot;Arial&quot;,&quot;sans-serif&quot;'</span><span style="color: #0000ff">&gt;</span><br />            <span style="color: #0000ff">&lt;</span><span style="color: #800000">img</span> <span style="color: #ff0000">border</span>=<span style="color: #ff0000">0</span> <span style="color: #ff0000">width</span>=<span style="color: #ff0000">866</span> <span style="color: #ff0000">height</span>=<span style="color: #ff0000">306</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;_x0000_i1025&quot;</span> <span style="color: #ff0000">src</span><span style="color: #0000ff">=&quot;file:///C:\Users\AKASH\AppData\Local\Temp\SnipImage-%7b91EAD0DB-1DBE-4E4A-B24B-F9CAB854BE82%7d.PNG&quot;</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">span</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">br</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">div</span><span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>

    <br /></div>
What should it have looked like? 

  <br />

  <div>
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span> <span style="color: #ff0000">lang</span>=<span style="color: #ff0000">EN-US</span> <span style="color: #ff0000">link</span>=<span style="color: #ff0000">blue</span> <span style="color: #ff0000">vlink</span>=<span style="color: #ff0000">purple</span> <span style="color: #ff0000">style</span><span style="color: #0000ff">='tab-interval:.5in'</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;</span><span style="color: #800000">div</span> <span style="color: #ff0000">class</span>=<span style="color: #ff0000">WordSection1</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">p</span> <span style="color: #ff0000">class</span>=<span style="color: #ff0000">MsoNormal</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;</span><span style="color: #800000">img</span> <span style="color: #ff0000">width</span>=<span style="color: #ff0000">661</span> <span style="color: #ff0000">height</span>=<span style="color: #ff0000">205</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;_x0000_i1025&quot;</span> <span style="color: #ff0000">src</span><span style="color: #0000ff">=&quot;cid:image001.png@01CDD4E9.F5F9A6E0&quot;</span><span style="color: #0000ff">&gt;</span><br />        <span style="color: #0000ff">&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">div</span><span style="color: #0000ff">&gt;</span><br /><span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
  </div>

  <div>&#160;</div>

  <div>In short, a link to the image was being sent instead of the image being sent with the mail. Why did this happen?</div>

  <div>
    <br />Process Monitor finally came to the rescue. Reviewing the logs we found that the “Send Pictures With Document” registry key was set to 0. i.e Outlook would send a link instead of including the picture with the message. More details on the key:

    <br />

    <div>
      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">Key: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Options\Mail<br />Value type: REG_DWORD<br />Value name; Send Pictures With Document<br />Value: 0</pre>
    </div>

    <div>&#160;</div>

    <div>If the Value is set to 1 or the key is not present, the picture is embedded as an hidden attachment pointed to by the Content-ID(cid).&#160; Why did it work in Safe mode? In Safe mode Outlook ignores certain registry settings and sometimes takes a different code path!</div>

    <div>&#160;</div>

    <div>Enjoy!</div>

    <div>
      <br /></div>
  </div></p>]]></content:encoded>
    </item>
    <item>
      <title>Stamping Archive Policy Tag using EWS Managed API from PowerShell(Exchange 2010)</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/stamping-archive-policy-tag-using-ews-managed-api-from-powershellexchange-2010</link>
      <pubDate>Fri, 07 Dec 2012 09:16:00 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2012/12/07/stamping-archive-policy-tag-using-ews-managed-api-from-powershellexchange-2010/</guid>
      <description><![CDATA[In a previous post I had explained how to stamp a Retention Policy Tag using EWS Managed API, In...]]></description>
      <content:encoded><![CDATA[<p>In a previous post I had explained how to stamp a <a href="https://blogs.msdn.com/b/akashb/archive/2011/08/11/stamping-retention-policy-tag-using-ews-managed-api-1-1-from-powershell-exchange-2010.aspx" target="_blank">Retention Policy Tag using EWS Managed API</a>, In this post I will explain the changes you will need to make to stamp an Archive Policy Tag. What&rsquo;s the difference between these two? Retention Policies consist of delete tags, i.e. retention tags with either Delete and Allow Recovery or Permanently Delete actions, or archive tags, i.e. retention tags with the Move To Archive action, which move items to the user's archive mailbox.</p>
<p>The requirement in this case to prevent the items in the notes folder from being moved to the Archived folder, a detailed explanation of the issue can be found <a href="https://blogs.technet.com/b/exchange/archive/2011/08/05/prevent-archiving-of-items-in-a-default-folder-in-exchange-2010.aspx" target="_blank">here</a>. Why is the Notes folder part of the issue? In Exchange 2010 SP1, support was added for the Notes folder. In Exchange 2010 RTM, items in the Notes folder aren't processed. After upgrade to SP1, if the user's retention policy doesn't have a Retention Policy Tag for the Notes folder, the Default Policy Tags from the user's policy will apply to items in that folder.</p>
<p>In short the workaround is to have users apply the Personal never move to archive personal tag (displayed as Never under Archive Policy in Outlook/OWA) to a default folder(Notes in this case). How do this archive personal tag look like? Below is a screenshot: <br /> <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/2146.image_4C23B5A0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/2146.image_5F00_4C23B5A0.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/8883.image_thumb_7F7F78FC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/8883.image_5F00_thumb_5F00_7F7F78FC.png" alt="image" width="451" height="501" border="0" /></a></p>
<p>Now that we have the Archive Policy Tag in place, we have to make a few changes in the code to get this to work. Most of the need code is the same as in the <a href="https://blogs.msdn.com/b/akashb/archive/2011/08/11/stamping-retention-policy-tag-using-ews-managed-api-1-1-from-powershell-exchange-2010.aspx" target="_blank">Retention Policy Tag using EWS Managed API</a> article. The change is in the &ldquo;StampPolicyOnFolder&rdquo; function which I have detailed below: </p>
<div id="codeSnippetWrapper">
<p><span style="color: #0000ff;">function</span> StampPolicyOnFolder($MailboxName)<br />{<br /> Write-host <span style="color: #006080;">"Stamping Policy on folder for Mailbox Name:"</span> $MailboxName -foregroundcolor $info<br /> Add-Content $LogFile (<span style="color: #006080;">"Stamping Policy on folder for Mailbox Name:"</span> + $MailboxName)<br /> <br /> <span style="color: #008000;">#Change the user <span style="color: #0000ff;">to</span> Impersonate</span><br /> $service.ImpersonatedUserId = new-object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress,$MailboxName)<span style="color: #008000;">;</span><br /><br /><span style="color: #008000;"> #Search for the folder you want to stamp the property on</span><br /> $oFolderView = new-object Microsoft.Exchange.WebServices.Data.FolderView(1)<br /> $oSearchFilter = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.FolderSchema]::DisplayName,$FolderName)<br /> $oFindFolderResults = $service.FindFolders([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot,$oSearchFilter,$oFolderView)<br /> <br /> <span style="color: #0000ff;">if</span> ($oFindFolderResults.TotalCount -eq 0)<br /> {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-host <span style="color: #006080;">"Folder does not exist in Mailbox:"</span> $MailboxName -foregroundcolor $warning<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add-Content $LogFile (<span style="color: #006080;">"Folder does not exist in Mailbox:"</span> + $MailboxName)<br /> }<br /> <span style="color: #0000ff;">else</span><br /> {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-host <span style="color: #006080;">"Folder found in Mailbox:"</span> $MailboxName -foregroundcolor $info<br /> <br /><span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #PR_ARCHIVE_TAG 0x3018 &ndash; We use the PR_ARCHIVE_TAG instead of the PR_POLICY_TAG</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ArchiveTag = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x3018,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Binary)<span style="color: #008000;">;</span></p>
<p><span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #PR_RETENTION_FLAGS 0x301D </span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $RetentionFlags = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x301D,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Integer)<span style="color: #008000;">;</span><br /><br /><span style="color: #008000;"> <span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#PR_ARCHIVE_PERIOD 0x301E - We use the PR_ARCHIVE_PERIOD instead of the PR_RETENTION_PERIOD</span><br /> <span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$ArchivePeriod = New-Object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x301E,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Integer)<span style="color: #008000;">;</span></p>
<p><span style="color: #008000;"> <span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#Change the GUID based on your policy tag</span><br /> <span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$ArchiveTagGUID = new-Object Guid(<span style="color: #006080;">"{3b7f5e7a-9016-4f87-a829-83f84c5adc62}"</span>)<span style="color: #008000;">;<br /><br /><span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#Bind to the folder found<br /></span><span style="color: #000000;"><span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$oFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$oFindFolderResults.Folders[0].Id)</span></p>
<p><span style="color: #008000;"><span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#Same as that on the policy - 16 specifies that this is a ExplictArchiveTag</span><br /> <span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$oFolder.SetExtendedProperty($RetentionFlags, 16)</p>
<p><span style="color: #008000;"><span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#Same as that on the policy - Since this tag is disabled the Period would be 0</span><br /> <span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$oFolder.SetExtendedProperty($ArchivePeriod, 0)<br /><br /> <span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$oFolder.Update()</p>
<p><span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Write-host <span style="color: #006080;">"Retention policy stamped!"</span> -foregroundcolor $info<br /> <span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Add-Content $LogFile (<span style="color: #006080;">"Retention policy stamped!"</span>)<br /> } <br /><br /> $service.ImpersonatedUserId = $null<br />}<br /><span style="color: #008000;">#Change the name of the folder. This is the folder the properties will be stamped on.</span><br />$FolderName = <span style="color: #006080;">"Notes"</span></p>
<br />With the above changes, you can now stamp an Archive Policy tag on multiple mailboxes and AFAIK there is no admin-controlled way of doing this. Once again, Thank you Vikas Soundade(Exchange) for helping me with the MRM piece!</div>
<div>Enjoy!</div>]]></content:encoded>
    </item>
    <item>
      <title>Outlook displaying the Red X mark instead of the Image</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/outlook-displaying-the-red-x-mark-instead-of-the-image</link>
      <pubDate>Fri, 31 Aug 2012 11:23:25 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2012/08/31/outlook-displaying-the-red-x-mark-instead-of-the-image/</guid>
      <description><![CDATA[This was a fun issue to troubleshoot! The problem : Compose a new mail in Outlook 2010, Insert a...]]></description>
      <content:encoded><![CDATA[<p>This was a fun issue to troubleshoot! The problem : Compose a new mail in Outlook 2010, Insert a image and send it to yourself. The expected behavior is that when you open the received mail, you see the Image.</p>  <p>In this case, instead of the Image we saw Red X mark with the message “The linked image cannot be displayed.&#160; The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location.” </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/3872.image_3AE533D4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/3872.image_5F00_3AE533D4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/56/94/metablogapi/6014.image_thumb_203897BB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-56-94-metablogapi/6014.image_5F00_thumb_5F00_203897BB.png" width="830" height="204" /></a></p>  <p>The interesting part was that everything worked fine in Safe mode! What could be causing this issue?   <br />In general, when we open an Item that has embedded images, the images are copied to a temp location which is then used for displaying the image. When the Item is closed the Images are deleted from that location. On further troubleshooting and debugging the issue, we noticed that in this case the Images never got created!</p>  <p>Knowing this was a BIG help to track down this issue. The question: Where is the temp location picked up from and does it really exist? On debugging we found that Outlook was reading the value from the follow key:   <br />    <br />    <div>     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cache</pre>
  </div>

  <div>
    <br />The value that was read in this case was %CACHEDIR%\Cache . Is this the right value? I guess NOT. In a working case it gives us the full path to the Temporary Internet Files, something like “C:\Documents and Settings\username\Local Settings\Temporary Internet Files”</div>

  <div>When I looked at a few machine in my environment the values were as below:</div>

  <div>On a Windows XP machine: %USERPROFILE%\Local Settings\Temporary Internet Files
    <br />On a Windows 7 machine: %USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files</div>

  <div>&#160;</div>

  <div>In this case the problem machine was a Windows XP machine, we replaced %CACHEDIR%\Cache with %USERPROFILE%\Local Settings\Temporary Internet Files and then restarted Outlook.</div>

  <div>Now everything WORKS?</div>

  <div>
    <br />Why did it work in Safe mode? In Safe mode, Outlook takes a different code path and a different API to get the temp folder location and does that successfully!

    <br /></div>

  <div>Enjoy!
    <br /></div></p>]]></content:encoded>
    </item>
    <item>
      <title>Exchange 2013 Preview is now AVAILABLE!</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/exchange-2013-preview-is-now-available</link>
      <pubDate>Fri, 03 Aug 2012 14:49:11 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2012/08/03/exchange-2013-preview-is-now-available/</guid>
      <description><![CDATA[Download Microsoft Exchange Server 2013 Preview...]]></description>
      <content:encoded><![CDATA[<p>   <br />Download Microsoft Exchange Server 2013 Preview    <br /><a title="https://technet.microsoft.com/en-US/evalcenter/hh973395" href="https://technet.microsoft.com/en-US/evalcenter/hh973395">https://technet.microsoft.com/en-US/evalcenter/hh973395</a></p>  <p><font size="2"><strong>Developer Resources for Exchange 2013</strong></font></p>  <p>EWS client design overview for Exchange 2013   <br /><a title="https://msdn.microsoft.com/en-us/library/jj190904(EXCHG.150).aspx" href="https://msdn.microsoft.com/en-us/library/jj190904(EXCHG.150).aspx">https://msdn.microsoft.com/en-us/library/jj190904(EXCHG.150).aspx</a></p>  <p>Exchange Web Services Managed API Version 2.0 - Technical Preview   <br /><a title="https://www.microsoft.com/en-us/download/details.aspx?id=30391" href="https://www.microsoft.com/en-us/download/details.aspx?id=30391">https://www.microsoft.com/en-us/download/details.aspx?id=30391</a></p>  <p>New features in EWS in Exchange 2013   <br /><a title="https://msdn.microsoft.com/en-us/library/jj190903(EXCHG.150).aspx" href="https://msdn.microsoft.com/en-us/library/jj190903(EXCHG.150).aspx">https://msdn.microsoft.com/en-us/library/jj190903(EXCHG.150).aspx</a></p>  <p>New features in the EWS Managed API   <br /><a title="https://msdn.microsoft.com/en-us/library/jj220500(EXCHG.80).aspx" href="https://msdn.microsoft.com/en-us/library/jj220500(EXCHG.80).aspx">https://msdn.microsoft.com/en-us/library/jj220500(EXCHG.80).aspx</a></p>  <p>Exchange 2013 101 Code Samples   <br /><a title="https://code.msdn.microsoft.com/Exchange-2013-101-Code-3c38582c" href="https://code.msdn.microsoft.com/Exchange-2013-101-Code-3c38582c">https://code.msdn.microsoft.com/Exchange-2013-101-Code-3c38582c</a></p>  <p>Get started with mail apps for Outlook 2013 and EWS in Exchange 2013   <br /><a title="https://msdn.microsoft.com/en-us/library/jj190901(EXCHG.150).aspx" href="https://msdn.microsoft.com/en-us/library/jj190901(EXCHG.150).aspx">https://msdn.microsoft.com/en-us/library/jj190901(EXCHG.150).aspx</a></p>  <p>Enjoy!</p>]]></content:encoded>
    </item>
    <item>
      <title>Using–Filter, Select-Object, ForEach-Object in C# – Exchange PowerShell Automation</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/usingfilter-select-object-foreach-object-in-c-exchange-powershell-automation</link>
      <pubDate>Wed, 01 Aug 2012 13:24:32 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2012/08/01/usingfilter-select-object-foreach-object-in-c-exchange-powershell-automation/</guid>
      <description><![CDATA[Have you ever tried migrating Exchange PowerShell script to be used from C# code?&#160; I needed to...]]></description>
      <content:encoded><![CDATA[<p>Have you ever tried migrating Exchange PowerShell script to be used from C# code?&#160; I needed to convert the following script to C#   <br />    <br />    <div id="codeSnippetWrapper">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">Get-Mailbox -<span style="color: #0000ff">filter</span> {ResourceType <span style="color: #cc6633">-ne</span> <span style="color: #006080">&quot;Room&quot;</span>}| Select-object Alias,DistinguishedName,Identity | <span style="color: #0000ff">foreach</span>-object {Get-MailboxFolderStatistics $_.Alias}</pre>

    <br />If you run the above script in Exchange 2010 Management Shell you might get the following error message:

    <br />

    <br />

    <div id="codeSnippetWrapper">
      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.<br />    + CategoryInfo          : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [],<br />   PSInvalidOperationException<br />    + FullyQualifiedErrorId : RemotePipelineExecutionFailed</pre>

      <br /></div>&#160; This error is caused because the Windows PowerShell remoting feature doesn't support more than one pipeline running at the same time. To resolve this issue, store the output of the cmdlet earlier in the pipeline in a variable, and then pipe the data stored in the variable to the ForEach cmdlet as shown below:

    <br />

    <br />

    <div id="codeSnippetWrapper">
      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">$Mailboxes = Get-Mailbox -<span style="color: #0000ff">filter</span> {ResourceType <span style="color: #cc6633">-ne</span> <span style="color: #006080">&quot;Room&quot;</span>}| Select-object Alias,DistinguishedName, Identity <br />$Mailboxes | <span style="color: #0000ff">foreach</span>-object {Get-MailboxFolderStatistics $_.Identity}</pre>

      <br />Now, to get the code working in C#. How do I use the Filter ? How do I use the Select-Object ? How do I store the intermediate result and then pass it into the ForEach-Object? The below code snippet shows how this can be done. I you need a full example of using Exchange PowerShell from C#, you can find it <a href="https://blogs.msdn.com/b/akashb/archive/2010/03/25/how-to-migrating-exchange-2007-powershell-managed-code-to-work-with-exchange-2010.aspx" target="_blank">here</a> .

      <br />

      <br />

      <div id="codeSnippetWrapper">
        <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><p><span style="color: #008000">//TODO: Create and Open Runspace, Create and Import Session</span><br /> <span style="color: #008000">//Create a pipline</span><br /> Pipeline pipe = runspace.CreatePipeline();</p><p> <span style="color: #008000">//Add the first command Get-Mailbox with the filters</span><br /> Command CommandGetMailbox = <span style="color: #0000ff">new</span> Command(<span style="color: #006080">&quot;Get-Mailbox&quot;</span>);<br /> CommandGetMailbox.Parameters.Add(<span style="color: #006080">&quot;Filter&quot;</span>, <span style="color: #006080">&quot;ResourceType -ne \&quot;Room\&quot;&quot;</span>);<br /> pipe.Commands.Add(CommandGetMailbox);</p><p> <span style="color: #008000">// Do a Select-Object on the fields</span><br /> var props = <span style="color: #0000ff">new</span> <span style="color: #0000ff">string</span>[] { <span style="color: #006080">&quot;Alias&quot;</span>, <span style="color: #006080">&quot;DistinguishedName&quot;</span>, <span style="color: #006080">&quot;Identity&quot;</span>};<br /> Command CommandSelect = <span style="color: #0000ff">new</span> Command(<span style="color: #006080">&quot;Select-Object&quot;</span>);<br /> CommandSelect.Parameters.Add(<span style="color: #006080">&quot;Property&quot;</span>, props);<br /> pipe.Commands.Add(CommandSelect);</p><p> <span style="color: #008000">//Invoke the First Pipeline and get the results</span><br /> resultMailboxes = pipe.Invoke();</p><p> <span style="color: #008000">// Create a second Pipeline..</span><br /> Pipeline pipe2 = runspace.CreatePipeline();</p><p> <span style="color: #008000">// Do a write-output of the results so that it can be piped to the foreach</span><br /> Command Command1 = <span style="color: #0000ff">new</span> Command(<span style="color: #006080">&quot;write-output&quot;</span>);<br /> Command1.Parameters.Add(<span style="color: #006080">&quot;InputObject&quot;</span>, resultMailboxes);<br /> pipe2.Commands.Add(Command1);</p><p> <span style="color: #008000">//Pipe into the ForEach</span><br /> Command CommandForEach = <span style="color: #0000ff">new</span> Command(<span style="color: #006080">&quot;ForEach-Object&quot;</span>);<br /> CommandForEach.Parameters.Add(<span style="color: #006080">&quot;Process&quot;</span>, ScriptBlock.Create(<span style="color: #006080">&quot;Get-MailboxFolderStatistics -Identity $_.Identity&quot;</span>));<br /> pipe2.Commands.Add(CommandForEach);</p><p> <span style="color: #008000">//Invoke the second Pipeline..</span><br /> resultMailboxes = pipe2.Invoke();<br /> //TODO: Display the results and clean up</p></pre>

        <br /></div>
Enjoy!

      <br />

      <br />

      <br /></div>

    <br />

    <br /></div></p>]]></content:encoded>
    </item>
    <item>
      <title>EWS Managed API is lying to me!</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/ews-managed-api-is-lying-to-me</link>
      <pubDate>Fri, 20 Jul 2012 12:19:00 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2012/07/20/ews-managed-api-is-lying-to-me/</guid>
      <description><![CDATA[I have been working with Exchange Web Services(EWS) for a long time and this is the first time I saw...]]></description>
      <content:encoded><![CDATA[<p>I have been working with Exchange Web Services(EWS) for a long time and this is the first time I saw that the EWS was lying to me! The code was executing a FindItem call on a list of folders and all of a sudden it threw the following error: “Error occurred: The request failed. The remote server returned an error: (401) Unauthorized”.</p>  <p>Why would that happen? If it was an authentication problem then why did my previous call work? The first step was to check the IIS Logs on the CAS server and below is what we find:</p>  <p id="codeSnippetWrapper"></p>  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">7/11/2012  10.171.230.40    POST /EWS/Exchange.asmx    SoapAction=FindItem 443    ExchangeServicesClient/14.03.0067.001    200     63025<br />7/11/2012  10.171.230.40    POST /EWS/Exchange.asmx    SoapAction=FindItem 443    ExchangeServicesClient/14.03.0067.001    200     21809<br />7/11/2012  10.171.230.40    POST /EWS/Exchange.asmx    SoapAction=FindItem 443    ExchangeServicesClient/14.03.0067.001    <font style="background-color: #ffff00">302     196752</font><br />7/11/2012  10.171.230.40    POST /EWS/Exchange.asmx    SoapAction=FindItem 443    ExchangeServicesClient/14.03.0067.001    <font style="background-color: #ffff00">302     196643</font><br /></pre>

<br />I chose to show only the relevant columns above. I you notice the highlighted values, the 302 is the HTTP Status code which means that the object has been temporarily moved. The last column is the time taken in milliseconds to execute the FindItem request. In the above case it was more than 3 minutes which is not good and means we have a LOTS of scope to optimize the code.



<p>But, why do I get the 302? I turned my attention to the Event Logs on the CAS box and I did not have to search too much. Below is what I saw:</p>

<div id="codeSnippetWrapper">
  <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">Log Name:      Application<br />Source:        ASP.NET 2.0.50727.0<br />Date:          7/11/2012 12:58:05 PM<br />Event ID:      1309<br />Task Category: Web Event<br />Level:         Warning<br />Keywords:      Classic<br />User:          N/A<br />Computer:      myserver.contoso.com<br />Description:<br />Event code: 3001 <br />Event message: The request has been aborted. <br />Event time: 7/11/2012 12:58:05 PM <br />Event time (UTC): 7/11/2012 4:58:05 PM <br />Event ID: 38a627eada914200923e244e9c83f7c8 <br />Event sequence: 6230694 <br />Event occurrence: 37 <br />Event detail code: 0 <br /> <br />Application information: <br />    Application domain: /LM/W3SVC/1/ROOT/EWS-1-129851299999841294 <br />    Trust level: Full <br />    Application Virtual Path: /EWS <br />    Application Path: C:\Program Files\Microsoft\Exchange Server\ClientAccess\exchweb\EWS\ <br />    Machine name: myserver<br /> <br />Process information: <br />    Process ID: 1152 <br />    Process name: w3wp.exe <br />    Account name: NT AUTHORITY\SYSTEM <br /> <br />Exception information: <br />    Exception type: HttpException <br />    Exception message: Request timed out. <br /> <br />Request information: <br />    Request URL: https://myserver.contoso.com:443/EWS/Exchange.asmx <br />    Request path: /EWS/Exchange.asmx <br />    User host address: 10.171.230.40 <br />    User: DOMAIN\Username <br />    Is authenticated: True <br />    Authentication Type: Negotiate <br />    Thread account name: NT AUTHORITY\SYSTEM <br /> <br />Thread information: <br />    Thread ID: 26 <br />    Thread account name: NT AUTHORITY\SYSTEM <br />    Is impersonating: False <br />    Stack trace: </pre>

  <br /></div>

<p>Now the picture is clearer! Since the request was running for more that 110 seconds which is default timeout in ASP.NET 2.0, the request was being aborted, which resulted in a 302 in the IIS logs. Now why did EWS Managed API return 401, frankly I did not bother to find! 
  <br />

  <br />To validate the cause we went ahead and increased the executionTimeout from 110 to 240 in the Web.Config for EWS and then we did not see the issue any more. This was done for TESTING only and is definitely not recommended.</p>

<p>There are two possible solutions to this issue: 
  <br />1) Optimize your code and use filters and <a href="https://msdn.microsoft.com/en-us/library/dd633698(EXCHG.80).aspx" target="_blank">paging</a> while doing FindItems (Recommended). 

  <br />2) Increase the <a href="https://msdn.microsoft.com/en-us/library/e1f13641(VS.80).aspx" target="_blank">executionTimeout</a> setting in the Web.Config(Not Recommended – can be tried only If optimization does not work ).</p>

<p>Enjoy!</p>]]></content:encoded>
    </item>
    <item>
      <title>Unable to send Bcc using System.Net.Mail when specifying a Pickup Directory(Exchange 2007/Exchange 2010) in code</title>
      <link>https://docs.microsoft.com/archive/blogs/akashb/unable-to-send-bcc-using-system-net-mail-when-specifying-a-pickup-directoryexchange-2007exchange-2010-in-code</link>
      <pubDate>Thu, 19 Jul 2012 15:49:38 GMT</pubDate>
      <dc:creator><![CDATA[Akashb]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/akashb/2012/07/19/unable-to-send-bcc-using-system-net-mail-when-specifying-a-pickup-directoryexchange-2007exchange-2010-in-code/</guid>
      <description><![CDATA[Not sure developers using System.Net.Mail are not complaining about this issue? The issue is very...]]></description>
      <content:encoded><![CDATA[<p>Not sure developers using System.Net.Mail are not complaining about this issue? The issue is very easy to reproduce, all you need to do is create a new mail with someone on Bcc and drop it to the Pickup folder In Exchange. Most likely not to many people use Bcc or use Port instead of Pickup.</p>  <div id="codeSnippetWrapper">   <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">MailMessage message = <span style="color: #0000ff">new</span> MailMessage(<span style="color: #006080">&quot;User1@mycompany.com&quot;</span>, <span style="color: #006080">&quot;User2@mycompany.com&quot;</span>, <span style="color: #006080">&quot;Sent Using Pickup&quot;</span>, <span style="color: #006080">&quot;This Message was sent using Pickup&quot;</span>);<br />message.Bcc.Add(<span style="color: #0000ff">new</span> MailAddress(<span style="color: #006080">&quot;User3@mycompany.com&quot;</span>));<br />SmtpClient client = <span style="color: #0000ff">new</span> SmtpClient();<br />client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;<br />client.PickupDirectoryLocation = <span style="color: #006080">@&quot;C:\Program Files\Microsoft\Exchange Server\TransportRoles\Pickup&quot;</span>;<br />client.Send(message);<br /></pre>

  <br />If we send a mail using the above code we would expect that the mail gets delivered to the Bcc user i.e User3@mycompany.com, but that does not happen! Why would that happen? I then tried to use CDOSYS to create a mail and added Bcc to it and this time the mail was delivered to User3@mycompany.com.</div>

<p>What could the difference be? I stopped the Transport service on my Exchange 2007(installed on Windows 2003) so that the mail do not get delivered by the transport and then examined the .eml to check what the difference could be. Below is what I find:</p>

<p>System.Net.Mail uses X-Headers to add the Recipient information to the mail.Below is what the MIME look like on my Windows 2003 box:
  <br />

  <div id="codeSnippetWrapper">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">X-Sender: User1@mycompany.com<br />X-Receiver: User2@mycompany.com<br /><font style="background-color: #ffff00">X-Receiver: User3@mycompany.com</font> <span style="color: #0000ff">&lt;</span>- This is the BCC<br />MIME-Version: 1.0<br />From: User1@mycompany.com<br />To: User2@mycompany.com<br />Date: 19 Jul 2012 13:53:05 -0400<br />Subject: Sent Using Pickup<br />Content-Type: text/plain; charset=us-ascii<br />Content-Transfer-Encoding: quoted-printable<br /><br />This Message was sent using Pickup</pre>

    <br />Below is what the MIME looks like when I used CDOSYS on my Windows 2003 box:

    <br />

    <div>
      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">thread-index: Ac1l181oBFqzycOSRFaCD7mjVftgqw==<br />Thread-Topic: This is a test CDOSYS message (Sent via Pickup)<br />From: <span style="color: #0000ff">&lt;</span><span style="color: #800000">User1</span>@<span style="color: #ff0000">mycompany</span>.<span style="color: #ff0000">com</span><span style="color: #0000ff">&gt;</span><br />To: <span style="color: #0000ff">&lt;</span><span style="color: #800000">User2</span>@<span style="color: #ff0000">mycompany</span>.<span style="color: #ff0000">com</span><span style="color: #0000ff">&gt;</span><br /><font style="background-color: #ffff00">Bcc: <span style="color: #0000ff">&lt;</span><span style="color: #800000">User3</span>@<span style="color: #ff0000">mycompany</span>.<span style="color: #ff0000">com</span><span style="color: #0000ff">&gt;</span></font><br />Subject: This is a test CDOSYS message (Sent via Pickup)<br />Date: Thu, 19 Jul 2012 13:56:20 -0400<br />Message-ID: <span style="color: #0000ff">&lt;</span><span style="color: #800000">D76CF8D778AE43A096B10F2281A9914F</span>@<span style="color: #ff0000">mycompany</span>.<span style="color: #ff0000">com</span><span style="color: #0000ff">&gt;</span><br />MIME-Version: 1.0<br />...</pre>
    </div>

    <div>
      <br />If you notice, the above MIME does not use X-Headers, it uses the Bcc header and it works. Unfortunately, this behavior of CDOSYS could be different on different environments. When I tested on a Windows 7 box, the MIME looks very similar to what we get from System.Net.Mail(uses X-Header).</div>

    <div>Based on my discussion with the Exchange guys, it turns out that when the mail is put in the Pickup folder, it does not look at the X-Headers and uses the From, To, Bcc headers if present.</div>

    <div>&#160;</div>

    <div>The simplest solution was to drop the mail in the Replay folder instead of the Pickup folder.</div>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">MailMessage message = <span style="color: #0000ff">new</span> MailMessage(<span style="color: #006080">&quot;User1@mycompany.com&quot;</span>, <span style="color: #006080">&quot;User2@mycompany.com&quot;</span>, <span style="color: #006080">&quot;Sent Using Pickup&quot;</span>, <span style="color: #006080">&quot;This Message was sent using Pickup&quot;</span>);<br />message.Bcc.Add(<span style="color: #0000ff">new</span> MailAddress(<span style="color: #006080">&quot;User3@mycompany.com&quot;</span>));<br />SmtpClient client = <span style="color: #0000ff">new</span> SmtpClient();<br />client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;<br /><font style="background-color: #ffff00">client.PickupDirectoryLocation = <span style="color: #006080">@&quot;C:\Program Files\Microsoft\Exchange Server\TransportRoles\Replay&quot;</span>;</font><br />client.Send(message);<br /></pre>

    <div>&#160;</div>

    <div>Below is an article that talks about both the directories, although it does not mention that X-Headers are ignored in the pickup, it does explicitly say that Replay makes use of the X-Headers.</div>

    <div>
      <br />Understanding the Pickup and Replay Directories

      <br /><a href="https://technet.microsoft.com/en-us/library/bb124230.aspx">https://technet.microsoft.com/en-us/library/bb124230.aspx</a></div>

    <div>
      <br />I have tested this on Exchange 2007 installed on Windows 2003 and it works!

      <br /></div>

    <div>Enjoy!</div>

    <div>
      <br /></div>

    <br /></div></p>]]></content:encoded>
    </item>
  </channel>
</rss>