Exchange Server Development forumWelcome to the Exchange Server Development forum, which covers all versions of Exchange Server.© 2009 Microsoft Corporation. All rights reserved.Wed, 12 Jun 2013 20:30:38 Z9d18fb17-7824-4a44-a58d-42928bc3a451https://social.technet.microsoft.com/Forums/en-US/93dc0685-4235-4831-8f71-c9c2c37b2580/owa-develop-query?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/93dc0685-4235-4831-8f71-c9c2c37b2580/owa-develop-query?forum=exchangesvrdevelopmentShelly Zhouhttps://social.technet.microsoft.com:443/profile/shelly%20zhou/?type=forumOWA develop query<p>Hello Experts,</p> <p>We would like to know whether there is a way to achieve below requirement?</p> <p>------ When we try to create a new email in OWA, we would like to have 3 options for us to select, for example option 1, option 2 &amp; option 3 in the new message window.&nbsp;&nbsp;<br/> <br/> Note: these options should only available when we write the message</p> <p>------- If possible, can we customize 3 transport agent to associated with these 3 options</p> <p></p> <p>Appreciate for your kind help:)</p>Wed, 17 Jan 2018 06:58:29 Z2018-01-23T01:37:57Zhttps://social.technet.microsoft.com/Forums/en-US/09f6b429-533e-49ec-b1e5-cb5546cd295b/e2016-inspect-incoming-mails-on-exchange-server-2016-on-a-global-level?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/09f6b429-533e-49ec-b1e5-cb5546cd295b/e2016-inspect-incoming-mails-on-exchange-server-2016-on-a-global-level?forum=exchangesvrdevelopmentCoder_Nhttps://social.technet.microsoft.com:443/profile/coder_n/?type=forum[E2016] Inspect incoming mails on Exchange Server 2016 on a global level<p>Hi. </p> <p>We are using E2016 and we would like to do inspect/tag all incoming mails. In particular store certain incoming mails to the file system and also add custom mail headers for later classification.<br/> <br/> Ideally this should be done on a global level and not on each Mailbox.<br/> <br/> So far we have an Outlook Plugin which does the job. But a downside is that Outlook needs to be running. Mails are only processed once they are received by Outlook. Which could be days later if the person is on vacation for example. Also it's very common that mails have multiple recipients which are received into many mailboxes. That causes the same mail to be processed multiple times, which is not ideal.<br/> <br/> What would be the preferred way of doing this?<br/> </p> <p>We do not have much experience with Exchange Server development so far. We looked into EWS, but it seems it's operating only on the mailbox level. I've also read about Transport Agents. But couldn't find any up to date developer documentation for 2016. For example can something like this still be done with Exchange 2016: https://msdn.microsoft.com/en-us/library/office/aa579185(v=exchg.140).aspx . Would this be the way to go?</p> <p>Regards.</p>Fri, 19 Jan 2018 13:49:37 Z2018-01-21T23:06:17Zhttps://social.technet.microsoft.com/Forums/en-US/b8865028-8316-462d-92f5-5f90c771e515/redmondexchangebuilde15?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/b8865028-8316-462d-92f5-5f90c771e515/redmondexchangebuilde15?forum=exchangesvrdevelopmentSerkan Kokturkhttps://social.technet.microsoft.com:443/profile/serkan%20kokturk/?type=forum\\REDMOND\EXCHANGE\BUILD\E15..<p>Hi,</p> <p>When I was developing a client application using EWS Managed API in order to get the mails from Exchange Server, I got an exception. I look its details and see some information about your development environment.</p> <p>Here the exception details.</p> <p>FYI</p> <p>Thanks</p> <p></p> <p>Serkan Köktürk</p> &nbsp; &nbsp; <p>at Microsoft.Exchange.WebServices.Data.EwsUtilities.ValidateParamAllowNull(Object param, String paramName) in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\EwsUtilities.cs:line 1106&nbsp;</p> <p>at Microsoft.Exchange.WebServices.Data.ExchangeService.FindItems(FolderId parentFolderId, SearchFilter searchFilter, ViewBase view) in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\ExchangeService.cs:line 935<br/> </p> <p></p>Thu, 18 Jan 2018 12:58:06 Z2018-01-18T12:58:06Zhttps://social.technet.microsoft.com/Forums/en-US/036e8347-d67f-4f45-b9e4-248bb1a7c818/exchange-web-services-the-request-failed-the-underlying-connection-was-closed-an-unexpected-error?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/036e8347-d67f-4f45-b9e4-248bb1a7c818/exchange-web-services-the-request-failed-the-underlying-connection-was-closed-an-unexpected-error?forum=exchangesvrdevelopmenttoujanihttps://social.technet.microsoft.com:443/profile/toujani/?type=forumExchange Web services :The request failed. The underlying connection was closed: An unexpected error occurred on a receive<table> <tbody> <tr> <td> <div><span class="x_x_vote-count-post"></span><br/> </div> </td> <td> <div> <div> <p>I m getting this error : T<strong>he request failed. The underlying connection was closed: An unexpected error occurred on a receive.</strong></p> <p>when im trying to read email from exchange server using EWS this is my code :</p> <pre class="lang-cs prettyprint prettyprinted" style=""><code><span class="pln"> </span><span class="kwd">try</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="typ">ServicePointManager</span><span class="pun">.</span><span class="typ">ServerCertificateValidationCallback</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="typ">CertificateValidationCallBack</span><span class="pun">;</span><span class="pln"> </span><span class="typ">ServicePointManager</span><span class="pun">.</span><span class="typ">MaxServicePoints</span><span class="pln"> </span><span class="pun">=</span><span class="lit">1000</span><span class="pun">;</span><span class="pln"> </span><span class="typ">ServicePointManager</span><span class="pun">.</span><span class="typ">MaxServicePointIdleTime</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="lit">10000</span><span class="pun">;</span><span class="pln"> </span><span class="typ">ServicePointManager</span><span class="pun">.</span><span class="typ">UseNagleAlgorithm</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="typ">ServicePointManager</span><span class="pun">.</span><span class="typ">Expect100Continue</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> </span><span class="typ">ServicePointManager</span><span class="pun">.</span><span class="typ">DefaultConnectionLimit</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="lit">10000</span><span class="pun">;</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> exchange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">ExchangeService</span><span class="pun">(</span><span class="typ">ExchangeVersion</span><span class="pun">.</span><span class="typ">Exchange2013</span><span class="pun">);</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">Credentials</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">WebCredentials</span><span class="pun">(</span><span class="str">&quot;user&quot;</span><span class="pun">,</span><span class="pln"> </span><span class="str">&quot;password&quot;</span><span class="pun">,</span><span class="pln"> </span><span class="str">&quot;domain&quot;</span><span class="pun">);</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">TraceEnabled</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">TraceFlags</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="typ">TraceFlags</span><span class="pun">.</span><span class="typ">All</span><span class="pun">;</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">AutodiscoverUrl</span><span class="pun">(</span><span class="str">&quot;mail-id&quot;</span><span class="pun">,</span><span class="pln"> </span><span class="typ">RedirectionUrlValidationCallback</span><span class="pun">);</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">Url</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">System</span><span class="pun">.</span><span class="typ">Uri</span><span class="pun">(</span><span class="str">&quot;https://URL/EWS/Exchange.asmx&quot;</span><span class="pun">);</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">KeepAlive</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">Timeout</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="lit">900000</span><span class="pun">;</span><span class="pln"> </span><span class="typ">WriteToFile</span><span class="pun">(</span><span class="str">&quot;Connected to Exchange Server : &quot;</span><span class="pln"> </span><span class="pun">&#43;</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">Url</span><span class="pun">.</span><span class="typ">Host</span><span class="pun">);</span><span class="pln"> </span><span class="typ">TimeSpan</span><span class="pln"> ts </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">TimeSpan</span><span class="pun">(</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="pun">-</span><span class="lit">15</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">);</span><span class="pln"> </span><span class="typ">DateTime</span><span class="pln"> date </span><span class="pun">=</span><span class="pln"> </span><span class="typ">DateTime</span><span class="pun">.</span><span class="typ">Now</span><span class="pun">.</span><span class="typ">Add</span><span class="pun">(</span><span class="pln">ts</span><span class="pun">);</span><span class="pln"> </span><span class="typ">SearchFilter</span><span class="pun">.</span><span class="typ">IsGreaterThanOrEqualTo</span><span class="pln"> filter </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">SearchFilter</span><span class="pun">.</span><span class="typ">IsGreaterThanOrEqualTo</span><span class="pun">(</span><span class="typ">ItemSchema</span><span class="pun">.</span><span class="typ">DateTimeReceived</span><span class="pun">,</span><span class="pln"> date</span><span class="pun">);</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">exchange </span><span class="pun">!=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="typ">FindItemsResults</span><span class="pun">&lt;</span><span class="typ">Item</span><span class="pun">&gt;</span><span class="pln"> findResults </span><span class="pun">=</span><span class="pln"> exchange</span><span class="pun">.</span><span class="typ">FindItems</span><span class="pun">(</span><span class="typ">WellKnownFolderName</span><span class="pun">.</span><span class="typ">Inbox</span><span class="pun">,</span><span class="pln"> filter</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">ItemView</span><span class="pun">(</span><span class="lit">999</span><span class="pun">));</span><span class="pln"> </span><span class="kwd">foreach</span><span class="pln"> </span><span class="pun">(</span><span class="typ">Item</span><span class="pln"> item </span><span class="kwd">in</span><span class="pln"> findResults</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="typ">EmailMessage</span><span class="pln"> message2 </span><span class="pun">=</span><span class="pln"> </span><span class="typ">EmailMessage</span><span class="pun">.</span><span class="typ">Bind</span><span class="pun">(</span><span class="pln">exchange</span><span class="pun">,</span><span class="pln"> </span><span class="pun">(</span><span class="typ">EmailMessage</span><span class="pun">.</span><span class="typ">Bind</span><span class="pun">(</span><span class="pln">exchange</span><span class="pun">,</span><span class="pln"> item</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">)).</span><span class="typ">Id</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">PropertySet</span><span class="pun">(</span><span class="typ">BasePropertySet</span><span class="pun">.</span><span class="typ">FirstClassProperties</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">ExtendedPropertyDefinition</span><span class="pun">(</span><span class="lit">0x1013</span><span class="pun">,</span><span class="pln"> </span><span class="typ">MapiPropertyType</span><span class="pun">.</span><span class="typ">Binary</span><span class="pun">)));</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> mailbosy </span><span class="pun">=</span><span class="pln"> message2</span><span class="pun">.</span><span class="typ">Body</span><span class="pun">.</span><span class="typ">Text</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span></code></pre> </div> </div> </td> </tr> </tbody> </table> <br/>Thu, 18 Jan 2018 08:55:19 Z2018-01-18T08:55:19Zhttps://social.technet.microsoft.com/Forums/en-US/920fa5dd-1d78-48ec-957e-8911004c6aa5/how-to-get-version-using-ews-powershell?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/920fa5dd-1d78-48ec-957e-8911004c6aa5/how-to-get-version-using-ews-powershell?forum=exchangesvrdevelopmentkaranrshahhttps://social.technet.microsoft.com:443/profile/karanrshah/?type=forumHow to get version using EWS powershell<p>$Service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1);<br/> </p> <p></p> <p>In the above line&nbsp;Exchange2013_SP1 is hardcoded. Using powershell how can I dynamically get the version when running the script?</p> <p></p> <p></p>Wed, 17 Jan 2018 18:56:21 Z2018-01-17T23:36:52Zhttps://social.technet.microsoft.com/Forums/en-US/4b1fe436-329c-44fd-aabb-0fe959b3ae12/create-a-folders-and-subfolders?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/4b1fe436-329c-44fd-aabb-0fe959b3ae12/create-a-folders-and-subfolders?forum=exchangesvrdevelopmentChristophe GIEShttps://social.technet.microsoft.com:443/profile/christophe%20gies/?type=forumcreate a folders and subfolders<div> <p>Hello,</p> <p>i have Script we create a folders </p> <p></p> <div># The script requires the EWS managed API, which can be downloaded here:<br/> # http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=c3342fb3-fbcc-4127-becf-872c746840e1<br/> # This also requires PowerShell 2.0<br/> # Make sure the Import-Module command below matches the DLL location of the API.<br/> # This path must match the install location of the EWS managed API. Change it if needed.<br/> [string]$info = &quot;White&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Color for informational messages<br/> [string]$warning = &quot;Yellow&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Color for warning messages<br/> [string]$error = &quot;Red&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Color for error messages<br/> [string]$LogFile = &quot;C:\Temp\log\Log2.txt&quot;&nbsp;&nbsp; # Path of the Log File</div> <div><br/> function CreateFolder($MailboxName)<br/> {<br/> &nbsp;&nbsp;&nbsp; Write-host &quot;Creating Folder for Mailbox Name:&quot; $MailboxName -foregroundcolor&nbsp; $info<br/> &nbsp;&nbsp;&nbsp; Write-host &quot;name parent Folder for Mailbox Name:&quot; $FolderNameparent -foregroundcolor&nbsp; $info<br/> &nbsp;&nbsp;&nbsp; Write-host &quot;name Folder for Mailbox Name:&quot; $FolderName -foregroundcolor&nbsp; $info<br/> &nbsp;&nbsp;&nbsp; Add-Content $LogFile (&quot;Creating Folder for Mailbox Name:&quot; &#43; $MailboxName)<br/> &nbsp;&nbsp;&nbsp; #Change the user to Impersonate<br/> &nbsp;&nbsp;&nbsp; $service.ImpersonatedUserId = new-object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress,$MailboxName);<br/> &nbsp;&nbsp;&nbsp; #Create the folder object</div> <div><br/> &nbsp;&nbsp;&nbsp; $oFolder = new-object Microsoft.Exchange.WebServices.Data.Folder($service)<br/> &nbsp;&nbsp;&nbsp; $oFolder.DisplayName = $FolderName<br/> &nbsp;&nbsp;&nbsp; #Call Save to actually create the folder<br/> &nbsp;&nbsp;&nbsp; $oFolder.Save([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::$foldernameparent)</div> <div>&nbsp;&nbsp;&nbsp; Write-host &quot;Folder Created for &quot; $MailboxName -foregroundcolor&nbsp; $warning<br/> &nbsp;&nbsp;&nbsp; Add-Content $LogFile (&quot;Folder Created for &quot; &#43; $MailboxName)<br/> &nbsp;&nbsp;&nbsp; $service.ImpersonatedUserId = $null<br/> }</div> <div>Import-Module -Name &quot;D:\Exchange2013\Bin\Microsoft.Exchange.WebServices.dll&quot;</div> <div>$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)<br/> # Set the Credentials</div> <div>$psCred = Get-Credential <br/> $creds = New-Object System.Net.NetworkCredential($psCred.UserName.ToString(),$psCred.GetNetworkCredential().password.ToString()) <br/> $service.Credentials = $creds </div> <div><br/> # Change the URL to point to your cas server<br/> $service.Url= new-object Uri(&quot;https://xxx.xxx.xx.xxx/EWS/Exchange.asmx&quot;)</div> <div># Set $UseAutoDiscover to $true if you want to use AutoDiscover else it will use the URL set above<br/> $UseAutoDiscover = $false<br/> #Read data from the UserAccounts.txt<br/> import-csv -Delimiter &quot;;&quot; -path &quot;.\UserAccounts.txt&quot; | foreach-object {<br/> &nbsp;&nbsp;&nbsp; $WindowsEmailAddress = $_.WindowsEmailAddress.ToString()<br/> &nbsp;&nbsp;&nbsp; $FolderNameparent = $_.foldernameparent.ToString()<br/> &nbsp;&nbsp;&nbsp; $FolderName = $_.foldername.ToString()</div> <div>&nbsp;&nbsp;&nbsp; if ($UseAutoDiscover -eq $true) {<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-host &quot;Autodiscovering..&quot; -foregroundcolor $info<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $UseAutoDiscover = $false<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $service.AutodiscoverUrl($WindowsEmailAddress)<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-host &quot;Autodiscovering Done!&quot; -foregroundcolor $info<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-host &quot;EWS URL set to :&quot; $service.Url -foregroundcolor $info</div> <div>&nbsp;&nbsp;&nbsp; }<br/> &nbsp;&nbsp;&nbsp; #To catch the Exceptions generated<br/> &nbsp;&nbsp;&nbsp; trap [System.Exception] <br/> &nbsp;&nbsp;&nbsp; {<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-host (&quot;Error: &quot; &#43; $_.Exception.Message) -foregroundcolor $error;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add-Content $LogFile (&quot;Error: &quot; &#43; $_.Exception.Message);<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue;<br/> &nbsp;&nbsp;&nbsp; }<br/> &nbsp;&nbsp;&nbsp; CreateFolder($WindowsEmailAddress)<br/> }</div> <div></div> <p></p> <p>But i want create a Subfolders </p> <p>the CSV is </p> <p>WindowsEmailAddress,foldernameparent,foldername<br/> xxxx@xxx0fr,msgfolderroot,Controls-2025,<br/> xxxx@xxx0fr,Controls-2025,2023-01,<br/> xxxx@xxx0fr,Controls-2025,2023-02,</p> <p>the script create controls-2025 but don't create 2023-01 or 2023-02</p> <p></p> <p>Can You help Me ?</p> <p></p> <p></p> </div>Tue, 16 Jan 2018 16:19:48 Z2018-01-17T16:14:12Zhttps://social.technet.microsoft.com/Forums/en-US/f79b46ba-26e7-48a2-bd01-69be48ccdad9/the-property-displayname-cannot-be-found-on-this-object-verify-that-the-property-exists-and-can?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/f79b46ba-26e7-48a2-bd01-69be48ccdad9/the-property-displayname-cannot-be-found-on-this-object-verify-that-the-property-exists-and-can?forum=exchangesvrdevelopmentslimhsshttps://social.technet.microsoft.com:443/profile/slimhss/?type=forumThe property 'DisplayName' cannot be found on this object. Verify that the property exists and can be set<p>Hello ! </p> <p>I've the error when i'm trying to execute the script below</p> <p>_____________________________________________________________________________________</p> <p>At D:\Scripts\gg\create folder in mailbox\AddFolderEWS\AddFoldersEWS.ps1:47 char:19<br/> &#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $folder = New-Object Microsoft.Exchange.WebServices.Data.Folder($exchser ...<br/> &nbsp;&nbsp;&nbsp; &#43; CategoryInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : ObjectNotFound: (:) [New-Object], PSArgumentException<br/> &nbsp;&nbsp;&nbsp; &#43; FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand<br/> <br/> The property 'DisplayName' cannot be found on this object. Verify that the property exists and can be set.<br/> At D:\Scripts\gg\create folder in mailbox\AddFolderEWS\AddFoldersEWS.ps1:48 char:9<br/> &#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $folder.DisplayName = &quot;Controls 2017&quot;;<br/> &nbsp;&nbsp;&nbsp; &#43; CategoryInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : InvalidOperation: (:) [], RuntimeException<br/> &nbsp;&nbsp;&nbsp; &#43; FullyQualifiedErrorId : PropertyNotFound<br/> <br/> You cannot call a method on a null-valued expression.<br/> At D:\Scripts\gg\create folder in mailbox\AddFolderEWS\AddFoldersEWS.ps1:49 char:9<br/> &#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $folder.Save([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]:: ...<br/> &nbsp;&nbsp;&nbsp; &#43; CategoryInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : InvalidOperation: (:) [], RuntimeException<br/> &nbsp;&nbsp;&nbsp; &#43; FullyQualifiedErrorId : InvokeMethodOnNull</p> <p>______________________________________________________________________________________________</p> <p>the script related to AddMailboxFolderEws :</p> <p>##Define the SMTP Address of the mailbox to impersonate<br/> <br/> $MailboxToImpersonate = &quot;salim.hassissi@externe.bnpparibas.com&quot;<br/> <br/> $dllpath = &quot;C:\Program Files\Microsoft\Exchange Server\V15\Bin\Microsoft.Exchange.WebServices.dll&quot;<br/> <br/> Import-Module $dllpath<br/> <br/> ## Set Exchange Version<br/> <br/> $ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013<br/> <br/> ###################################################################################<br/> foreach ($muid in $list) {<br/> &nbsp;&nbsp;&nbsp; Add-MailboxPermission $MUID -User &quot;salim.hassissi@externe.bnpparibas.com&quot; -AccessRights FullAccess<br/> &nbsp;&nbsp; &nbsp;<br/> &nbsp;&nbsp;&nbsp; start-sleep 2<br/> &nbsp;&nbsp; &nbsp;<br/> &nbsp;&nbsp;&nbsp; $mailaddress = $null<br/> <br/> &nbsp;&nbsp;&nbsp; $mailaddress = (Get-Mailbox $muid).windowsemailaddress.tostring()<br/> &nbsp;&nbsp;&nbsp; $pwd=&quot;xxxxxxxxxxx&quot;<br/> &nbsp;&nbsp;&nbsp; if ($mailaddress) {<br/> <br/> Import-Module -Name &quot;C:\Program Files\Microsoft\Exchange Server\V15\Bin\Microsoft.Exchange.WebServices.dll&quot;<br/> ## Create Exchange Service Object<br/> <br/> $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService($ExchangeVersion)<br/> <br/> # Set the Credentials<br/> <br/> $psCred = Get-Credential <br/> $creds = New-Object System.Net.NetworkCredential($psCred.UserName.ToString(),$psCred.GetNetworkCredential().password.ToString()) <br/> $service.Credentials = $creds <br/> <br/> ## Set the URL of the CAS (Client Access Server)<br/> <br/> $service.AutodiscoverUrl($AccountWithImpersonationRights ,{$true})<br/> <br/> #Read data from the UserAccounts.txt<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $folder = New-Object Microsoft.Exchange.WebServices.Data.Folder($exchservice);<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $folder.DisplayName = &quot;Controls 2017&quot;;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $folder.Save([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox);<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-Host &quot;Done for $($muid)&quot;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #$Rootfolderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::msgFolderRoot,$mailboxname)<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; start-sleep 2<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sublijst=&quot;2017/01&quot;,&quot;2017/02&quot;,&quot;2017/03&quot;,&quot;2017/04&quot;,&quot;2017/05&quot;,&quot;2017/06&quot;,&quot;2017/07&quot;,&quot;2017/08&quot;,&quot;2017/09&quot;,&quot;2017/10&quot;,&quot;2017/11&quot;,&quot;2017/12&quot;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach ($subl in $sublijst)<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $InboxFolder = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$ImpersonatedMailboxName);<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $InboxFolder.DisplayName = $subl;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $InboxFolder.Save($InboxFolder.ID);<br/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$Inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$InboxFolder)<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write-Host &quot;Done for $($muid)&quot;<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/> <br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/> <br/> &nbsp;&nbsp;&nbsp; else {<br/> <br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Add-Content -Path &quot;D:\Tools\Exchange\Fred\EWS\output.txt&quot; -Value &quot;Could not find a mailaddresss for $($muid)&quot;<br/> <br/> &nbsp;&nbsp;&nbsp; }<br/> &nbsp;&nbsp;&nbsp; Remove-MailboxPermission $MUID -User &quot;salim.hassissi@externe.bnpparibas.com&quot; -AccessRights FullAccess -Confirm:$false</p> <p></p> <p>thanks in advance for your help</p> <p></p> <p></p> <p></p>Tue, 16 Jan 2018 13:48:46 Z2018-01-17T15:11:11Zhttps://social.technet.microsoft.com/Forums/en-US/0b565ae3-4a31-4918-b404-47ca3c65aad4/imap-retrieve-mailboxes-in-a-particular-distribution-list-using-the-dl-name?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/0b565ae3-4a31-4918-b404-47ca3c65aad4/imap-retrieve-mailboxes-in-a-particular-distribution-list-using-the-dl-name?forum=exchangesvrdevelopmentJaya Prakash Reddyhttps://social.technet.microsoft.com:443/profile/jaya%20prakash%20reddy/?type=forumIMAP: Retrieve mailboxes in a particular distribution list using the DL name <p>Hi,</p> <p>I want to retrieve all the mailboxes that are present under a Distribution list using admin credentials.</p> <p>1) Is it possible to achieve the above using the IMAP cmds.</p> <p>2) Is there any API present in PHP or C that can help me achieve it.</p> <p></p> <p>Thanks and Regards</p> <p>Jaya Prakash</p>Wed, 17 Jan 2018 13:41:10 Z2018-01-17T13:41:10Zhttps://social.technet.microsoft.com/Forums/en-US/99a4c736-8b1b-47bf-99c0-58800deb61e7/streaming-notification-connection-reopen-error-you-must-add-at-least-one-subscription-to-this?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/99a4c736-8b1b-47bf-99c0-58800deb61e7/streaming-notification-connection-reopen-error-you-must-add-at-least-one-subscription-to-this?forum=exchangesvrdevelopmentHongqing Sunhttps://social.technet.microsoft.com:443/profile/hongqing%20sun/?type=forumStreaming notification connection reopen error: You must add at least one subscription to this connection before it can be opened.<p>We are developing a long time running windows service which is monitoring an email account with EWS API 2.2. The connection interval is the maximum allowed value 30 minutes, and thus the connection is reopened inside the OnDisconnect event handler every 30 minutes. After the service keeps on running for couple of days (1 day or 2 or more), the error happens:</p> <p>You must add at least one subscription to this connection before it can be opened.:You must add at least one subscription to this connection before it can be opened.<br/> StackTrace: ' at the method of Void OnDisconnect(System.Object, Microsoft.Exchange.WebServices.Data.SubscriptionErrorEventArgs).</p> <p></p> <p>Any idea?</p>Mon, 16 Mar 2015 17:28:47 Z2018-01-16T20:07:05Zhttps://social.technet.microsoft.com/Forums/en-US/58a6fbd7-7634-4b99-b55a-968d2b7f6f3d/ews-connection-problem-a-connection-that-was-expected-to-be-kept-alive-was-closed-by-the-server?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/58a6fbd7-7634-4b99-b55a-968d2b7f6f3d/ews-connection-problem-a-connection-that-was-expected-to-be-kept-alive-was-closed-by-the-server?forum=exchangesvrdevelopmenttodomatihttps://social.technet.microsoft.com:443/profile/todomati/?type=forumEWS Connection Problem - A connection that was expected to be kept alive was closed by the server<div>Hi Together</div> <div> <p>I have a problem binding an mailbox apointments with powershell&nbsp;via ews 2.2 interface since exchange update to 2016CU8 15.1.1415.2.<br/> Our previos Excahnge Version was 2016CU7 15.1.1261.35 and the script was working in this version without any problems <br/> Since update to CU8 we are getting from time to time following error message from the Bind method:</p> <p></p> </div> <div><em>Exception calling &quot;Bind&quot; with &quot;3&quot; argument(s): &quot;The request failed. The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.&quot;</em></div> <div> <p></p> <p>When the problem ocure script is stucking for a while on Bind method finishing with above mentioned error message.</p> </div> <div> <p>This is the method i am using to bind:</p> <pre class="prettyprint">$ExchangeObjBind = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid,$propertySet)</pre> <br/> <p></p> </div> <div>I am connecting to EWS with function &quot;ConnectExchangeService&quot; down below and using that connection as variable ($service in bind method) for bind method.</div> <pre class="prettyprint">Function ConnectExchangeService($ExchangeServer) { [Reflection.Assembly]::LoadFile(&quot;C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll&quot;) | Out-Null $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1) $service.Url = new-object Uri(&quot;https://$ExchangeServer/ews/exchange.asmx&quot;) return $service }</pre> <br/> <div>The Script is running on Exchange Server itself not connecting via network.</div> <div> <p>Is this problem already known? Do you have any sugestion how we can solve it?</p> <p></p> <p>Thanks in advance for your replay</p> </div> <div></div> <div></div> <div></div> <p></p> <p></p> <p></p> <br/> <br/> <br/>Thu, 11 Jan 2018 12:47:34 Z2018-01-16T16:33:42Zhttps://social.technet.microsoft.com/Forums/en-US/8c055e39-27fb-4f38-9fdd-dec2dbc58499/how-to-update-the-notes-field-on-a-contact?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/8c055e39-27fb-4f38-9fdd-dec2dbc58499/how-to-update-the-notes-field-on-a-contact?forum=exchangesvrdevelopmentsjb500https://social.technet.microsoft.com:443/profile/sjb500/?type=forumHow to update the Notes field on a Contact<p>Hi</p> <p>I'm using EWS and I have an app that creates Contact items and updates them as necessary.</p> <p>Does anyone know how to update the <strong>Notes </strong>field? Like the other fields that I already update, eg title, id etc I've been looking for the specific ExtendedFieldURI Property Tag (eg 0x3A05)&nbsp;for Notes but cannot find it. Is there another way?</p> <p>Thanks</p>Tue, 16 Oct 2012 12:09:24 Z2018-01-16T16:18:04Zhttps://social.technet.microsoft.com/Forums/en-US/958cd1f2-91db-4b57-91bc-102a3e241c07/exchange-soap-update-notes-contact-?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/958cd1f2-91db-4b57-91bc-102a3e241c07/exchange-soap-update-notes-contact-?forum=exchangesvrdevelopmentSabri Mbarekhttps://social.technet.microsoft.com:443/profile/sabri%20mbarek/?type=forumExchange Soap Update notes contact ?<p style="padding-right:0px; font-size:15px; line-height:inherit; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; vertical-align:baseline; clear:both; color:#242729"> I was unable to execute a Soap Exhange request to update contacts:PersonalNotes .</p> <p style="padding-right:0px; font-size:15px; line-height:inherit; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; vertical-align:baseline; clear:both; color:#242729"> I have not found documentation on msdn.</p> <p style="padding-right:0px; font-size:15px; line-height:inherit; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; vertical-align:baseline; clear:both; color:#242729"> this is my soap code:</p> <p style="padding-right:0px; font-size:15px; line-height:inherit; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; vertical-align:baseline; clear:both; color:#242729"> </p> <pre class="prettyprint">&lt;soap:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:m=&quot;http://schemas.microsoft.com/exchange/services/2006/messages&quot; xmlns:t=&quot;http://schemas.microsoft.com/exchange/services/2006/types&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt; &lt;soap:Header&gt; &lt;t:RequestServerVersion Version=&quot;Exchange2016&quot; /&gt; &lt;t:TimeZoneContext&gt; &lt;t:TimeZoneDefinition Id=&quot;Eastern Standard Time&quot; /&gt; &lt;/t:TimeZoneContext&gt; &lt;/soap:Header&gt; &lt;soap:Body&gt; &lt;m:UpdateItem MessageDisposition=&quot;SaveOnly&quot; ConflictResolution=&quot;AlwaysOverwrite&quot;&gt; &lt;m:ItemChanges&gt; &lt;t:ItemChange&gt; &lt;t:ItemId Id=&quot;AAMkAD...QAAAz9hI5AAA=&quot; ChangeKey=&quot;EQAAAB...QAAAz9rdN&quot; /&gt; &lt;t:Updates&gt; &lt;t:SetItemField&gt; &lt;t:FieldURI FieldURI=&quot;contacts:Notes&quot; /&gt; &lt;t:Contact&gt; &lt;t:Notes&gt;TEST N&lt;/t:Notes&gt; &lt;/t:Contact&gt; &lt;/t:SetItemField&gt; &lt;/t:Updates&gt; &lt;/t:ItemChange&gt; &lt;/m:ItemChanges&gt; &lt;/m:UpdateItem&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt;</pre> <p><br/> </p> <p style="padding-right:0px; font-size:15px; line-height:inherit; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; vertical-align:baseline; clear:both; color:#242729"> <span style="color:#242729; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; font-size:15px">What is the soap code to write to edit the Contact PersonalNotes ?</span></p> <p style="padding-right:0px; font-size:15px; line-height:inherit; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; vertical-align:baseline; clear:both; color:#242729"> <span style="color:#242729; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; font-size:15px"></span></p>Tue, 16 Jan 2018 16:10:01 Z2018-01-16T16:10:01Zhttps://social.technet.microsoft.com/Forums/en-US/19ef44ee-605c-438a-aad0-f159ddaedcce/what-is-the-expiration-time-of-a-streaming-subscription-id?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/19ef44ee-605c-438a-aad0-f159ddaedcce/what-is-the-expiration-time-of-a-streaming-subscription-id?forum=exchangesvrdevelopmentm3driverhttps://social.technet.microsoft.com:443/profile/m3driver/?type=forumWhat is the expiration time of a Streaming Subscription ID<p>I have an application that will subscribe to every mailbox for streaming notifications. Obviously in a large organization it will take some time to obtain all the Subscription ID's. I could optimize this by saving the Subscription ID's in a local database and, if the application is restarted, then re-subscribe with these cached ID's.&nbsp;</p> <p>I assume that after a period of time the cached ID will become stale and I must re-subscribe however I cannot find any documentation that describes the expiration time. Does any know what that time is?</p> <p>Alan</p>Mon, 18 Jul 2016 20:13:41 Z2018-01-16T11:41:50Zhttps://social.technet.microsoft.com/Forums/en-US/3865a306-8aad-4762-a111-01b4858ff669/streaming-subscription-stops-sending-events?forum=exchangesvrdevelopmenthttps://social.technet.microsoft.com/Forums/en-US/3865a306-8aad-4762-a111-01b4858ff669/streaming-subscription-stops-sending-events?forum=exchangesvrdevelopmentHognihttps://social.technet.microsoft.com:443/profile/hogni/?type=forumStreaming subscription stops sending events<p>EWS Managed API 1.1, Exchange 2010SP1, C# in VS2010SP1</p> <p>I'm using streaming subs and after a while (indeterminate time and number of messages but on average 1 hour, ~50) notifications, the subscription stops raising events. Sometimes when this happens the EWS IIS becomes unresponsive and hangs. This is under no great load, I'm only monitoring 3 mailboxes in this test phase, and the load I'm testing with is around 20 messages per minute.</p> <p>This behaviour continues through reconnections until I restart the EWS IIS instance. Is this a known issue?</p> <p>Following is the code that constructs the connection and subscriptions:</p> <p></p> <div style="color:Black;background-color:White;"><pre> <span style="color:Blue;">public</span> EmailMonitor() { XmlConfigurator.Configure(); <span style="color:Blue;">if</span>(_log == <span style="color:Blue;">null</span>) _log = LogManager.GetLogger(GetType()); _log.Info(<span style="color:#A31515;">&quot;Constructor START&quot;</span>); _processedEmails = <span style="color:Blue;">new</span> List&lt;ProcessedEmail&gt;(); _employeeLimitedList = <span style="color:Blue;">new</span> List&lt;<span style="color:Blue;">string</span>&gt;((ConfigurationManager.AppSettings[<span style="color:#A31515;">&quot;EmployeeLimitedList&quot;</span>] ?? <span style="color:Blue;">string</span>.Empty).Split(<span style="color:#A31515;">&#39;,&#39;</span>)); _tracer = <span style="color:Blue;">new</span> MalaskraTracer(_log); ServicePointManager.ServerCertificateValidationCallback = OnValidationCallback; _service = GetService(); _log.Info(<span style="color:#A31515;">&quot;Constructor COMPLETE&quot;</span>); } <span style="color:Blue;">private</span> <span style="color:Blue;">static</span> ExchangeService GetService() { <span style="color:Blue;">return</span> <span style="color:Blue;">new</span> ExchangeService(ExchangeVersion.Exchange2010_SP1) { Url = <span style="color:Blue;">new</span> Uri(_exUrl), UseDefaultCredentials = _exUsername == <span style="color:Blue;">null</span> || _exPassword == <span style="color:Blue;">null</span>, ImpersonatedUserId = _malaskraImpersonatedUserId, AcceptGzipEncoding = <span style="color:Blue;">true</span>, PreferredCulture = CultureInfo.GetCultureInfo(<span style="color:#A31515;">&quot;IS&quot;</span>), Timeout = 15000 <span style="color:Green;">/* TraceEnabled = true, TraceListener = _tracer, TraceFlags = TraceFlags.DebugMessage */</span> }; } <span style="color:Blue;">public</span> <span style="color:Blue;">void</span> Start(<span style="color:Blue;">int</span> serviceTimeout = 10) { _log.Debug(<span style="color:#A31515;">&quot;Start() - Starting&quot;</span>); _malaskraFolder = Folder.Bind(_service, WellKnownFolderName.Inbox); FolderSearch.GetUserMailFolders(_malaskraFolder, _folders); BuildSubscriptions(); <span style="color:Blue;">try</span> { _service.ImpersonatedUserId = _malaskraImpersonatedUserId; _subscriptionConnection = <span style="color:Blue;">new</span> StreamingSubscriptionConnection(_service, serviceTimeout); _subscriptionConnection.OnNotificationEvent += OnEvent; _subscriptionConnection.OnSubscriptionError += OnError; _subscriptionConnection.OnDisconnect += OnDisconnect; <span style="color:Blue;">foreach</span> (SubscriptionInfo info <span style="color:Blue;">in</span> _subscriptionUserMap) { _subscriptionConnection.AddSubscription(info.Subscription); _log.Debug(<span style="color:#A31515;">&quot;Added subscription &quot;</span> + info.Subscription.Id + <span style="color:#A31515;">&quot; for &quot;</span> + info.UserEmail); } _subscriptionConnection.Open(); } <span style="color:Blue;">catch</span> (ServiceResponseException ex) { _log.Error(<span style="color:#A31515;">&quot;Error creating subscriptions&quot;</span>, ex); <span style="color:Blue;">throw</span>; } <span style="color:Blue;">catch</span>(Exception ex) { _log.Error(ex.Message, ex); } <span style="color:Green;">/* _syncTimer = new Timer(60000); _syncTimer.Elapsed += SyncNow; _syncTimer.Start(); */</span> _log.Debug(<span style="color:#A31515;">&quot;Start() - Finished&quot;</span>); } <span style="color:Blue;">private</span> <span style="color:Blue;">void</span> BuildSubscriptions() { List&lt;<span style="color:Blue;">string</span>&gt; allEmployees; <span style="color:Blue;">if</span> (_employeeLimitedList.Count &gt; 0) { allEmployees = (<span style="color:Blue;">from</span> emp <span style="color:Blue;">in</span> _mimisbrunnur.EmployeesVs <span style="color:Blue;">where</span> _employeeLimitedList.Contains(emp.UserName) <span style="color:Blue;">select</span> emp.Email).ToList(); _log.Debug(<span style="color:#A31515;">&quot;allEmployees &quot;</span> + <span style="color:Blue;">string</span>.Join(<span style="color:#A31515;">&quot;, &quot;</span>, allEmployees.ToArray())); } <span style="color:Blue;">else</span> { allEmployees = (<span style="color:Blue;">from</span> emp <span style="color:Blue;">in</span> _mimisbrunnur.EmployeesVs <span style="color:Blue;">select</span> emp.Email).ToList(); } _subscriptionUserMap.Add(<span style="color:Blue;">new</span> SubscriptionInfo(_service, MalaskraEmail)); <span style="color:Blue;">foreach</span> ( <span style="color:Blue;">string</span> email <span style="color:Blue;">in</span> allEmployees.Select( empEmail =&gt; _emailDomain != <span style="color:Blue;">null</span> ? empEmail.Replace(<span style="color:#A31515;">&quot;vis.is&quot;</span>, _emailDomain) : empEmail)) { <span style="color:Blue;">try</span> { _subscriptionUserMap.Add(<span style="color:Blue;">new</span> SubscriptionInfo(_service, email)); _log.Debug(<span style="color:#A31515;">&quot;Added sub for &quot;</span> + email); } <span style="color:Blue;">catch</span> (Exception ex) { _log.Warn(ex.Message, ex); } } } </pre></div> <p></p> <p>As yo Internal Server Error
Internal Server Error

Sorry, We were unable to service your request. Please try again later.

For the latest headlines and see what's new, visit the TechNet home page.

Check out the various Tech Centers where you can find the latest product information, technical resources and community offerings.

Visit the TechNet Library for the latest technical articles, reference documentation, downloads and more.

Browse to TechNet Forums to get fast answers for technical questions or use the search option below to find out other relevant resources.