How strong is the encryption on inbound and outbound connectors?
user defined forms and Exchange 2010
Hi together,
Exchange 2010 SP2.
We have a very big user defined form designed in Outlook having lots of user defined properties. It worked fine for years.
After another smal change (and after Publishing the Outlook form) an error occured:
"unable to load the form. contact your admin." Unfortunately that's me.
I tried different Outlook Clients with different Outlook versions. No success. I expected the form is corrupt but exporting in to another 2 Exchange 2010 Environments with the same cleints the form works perfect. Exported it there and send it back but no success.
So it has to be the Exchange Server Environment that causes the error.
The old version of the form still works.
Because there is no error message on Client or on Server I don't know how to go ahaed. Help is needed...
Help is needed!!!
Greetings/Grüße Gernot
EWS and Exchange 2010 SP2 - Save Meeting Request to Drafts instead of sending?
I'm trying to selectively send Meeting Requests/Updates only to specific attendees on an Appointment. I don't think that this is possible, at least not without removing the Attendees from the Appointment, saving without sending updates, then add the specific attendees back to it, save and send updates, then add the rest back and save again without sending updates. I'm not even certain that will work because I don't think I'd even want to implement that kind of hackneyed workaround.
I could've sworn I'd seen some method of saving Meeting Requests to another folder, probably Drafts, instead of sending them, but I can't seem to make that happen. Is this possible? It would at least allow me to select only the Requests I want to send and update them to the Sent Items folder, but my memory may deceive me and this may not be feasible through EWS.
How can i get newly added contacts for a Mailbox User in Exchange Server 2013
Hi all,
I need to synchronize contacts in Exchange Server and Sugar CRM Application, for that
i need to get newly added contacts for a User in Exchange Server 2013 by using EWS Managed API.
I know how get the list of all contacts for a particular user , but in the list how i can find
new contacts ?Support for Exchange Databases running within VMDKs on NFS datastores
The virtualization community are asking Microsoft to change their support position for Exchange Server running in VMDKs on NFS datastores. Support is long overdue.
The virtualized SCSI stack, including initiators and disks inside of a VM, are unaware of the underlying storage protocol that provides data connectivity between a hypervisor and storage device. Support is long overdue and the rationale for the lack of support is not recognized by the storage industry.
The following co-authors (from 7 different vendors & 2 solution integrators) are aiming to work together for the good of our customers and the community too raise awareness of this issue in the hopes that Microsoft will reconsider the support policy.
Josh Odgers (@josh_odgers)
Senior Solutions & Performance Engineer @ Nutanix
VMware Certified Design Expert #90 & vExpert
Vaughn Stewart (@vStewed)
Chief Evangelist @ Pure Storage
vExpert
Chad Sakac(@sakacc)
SVP, Global Systems Engineering @ EMC
vExpert
Matt Liebowitz (@mattliebowitz)
Solution Architect @ EMC
VCP & vExpert & author ofVirtualizing Microsoft Business Critical Applications on VMware vSphere
Michael Webster (@vcdxnz001)
Senior Solutions & Performance Engineer @ Nutanix
VMware Certified Design Expert #66 & vExpert
Andrew Mitchell (@amitchell01)
Consulting Architect @ VMware
VMware Certified Design Expert #30
Rob Waite (@rob_waite_oz)
Solution Architect @ Tintri
VCP & vExpert
Nick Howell (@that1guynick)
vTME @ Netapp
vExpert
Chris Wahl (@ChrisWahl)
Solution Architect @ AHEAD
VMware Certified Design Expert #104
Gabriel Chapman (@bacon_is_king)
Solution Architect @ Simplivity
www.gabrielchapman.com
VCP & vExpert
Mahmoud Magdy
Senior Technical Architect
vExpert, MVP and Symantec BExpert
The Details of Microsoft’s Position
At present, Microsoft supports Exchange deployments on NAS, specifically only on their hypervisor and their file based protocol, SMB 3.0. The intent of our efforts is to address the gap in supporting Exchange in VMware vSphere & KVM with datastores connect via NFS 3.0.
The support policy can be foundhere and is summarized below...
“The storage used by the Exchange guest machine for storage of Exchange data (for example, mailbox databases and transport queues) can be virtual storage of a fixed size (for example, fixed virtual hard disks (VHDs) in a Hyper-V environment), SCSI pass-through storage, or Internet SCSI (iSCSI) storage. Pass-through storage is storage that's configured at the host level and dedicated to one guest machine. All storage used by an Exchange guest machine for storage of Exchange data must be block-level storage because Exchange 2013 doesn't support the use of network attached storage (NAS) volumes, other than in the SMB 3.0 scenario outlined later in this topic. Also, NAS storage that's presented to the guest as block-level storage via the hypervisor isn't supported.”
Another statement of interest in the above link is as follows;
"Configuring iSCSI storage to use an iSCSI initiator inside an Exchange guest virtual machine is supported. However, there is reduced performance in this configuration if the network stack inside a virtual machine isn't full-featured (for example, not all virtual network stacks support jumbo frames)."
While the contributors to this post agree this is not an ideal configuration, it is not a performance issue when used with enterprise grade storage and with properly architected networking.
The support statements is odd as there is a large portion of the VMware market that is deployed over NFS. This configuration is supported and is the preferred means of data connectivity for many. A decade ago, one could run Exchange 5.5 over NAS (CIFS). This support was removed with Exchange 2000. It appears the concerns from the Exchange 5.5. The difference with a virtualized instance is the Exchange application is NOT accessing data via NAS. All VM data access is via virtualized SCSI.
This may be a valid (or legacy) support policy back in the days before virtualization became mainstream, and before the evolution of 10/40Gb Ethernet where performance may have been limited by 1GB connections (as opposed to the NFS protocol itself) or for deployments where NFS is presented directly into the Guest OS which we agree would not work.
The abstraction of virtual SCSI from the underlying infrastructure (FC, DAS, iSCSI or NFS) is shown in the below diagram courtesy of http://pubs.vmware.com
Over the years, the contributors of this community post have seen countless successful deployments of Exchange on vSphere, using both block (FC,FCoE,iSCSI) and file based storage (NFS/SMB) so why is only NFS not supported?
There are a number of blog posts related to Exchange and NFS storage, one such example is by Tony Redmond (@12Knocksinna), titled “NFS and Exchange, Not a good combination”.
To Tony’s credit, he goes much further than most posts we have seen, which in most cases just say “Its not supported” and give no technical justification as to why.
Tony wrote
“One small, but terribly important issue is Exchange’s requirement that it should be able to abort a transaction should bad things happen. Block-level storage allows this to happen but file-level storage supports aborts on a best-effort basis. Simply put, without the ability for an application to signal the storage subsystem that a transaction should be aborted, you run the risk of introducing corruptions into the databases through bad transactions.”
With a VMDK presented to Exchange, we are not aware of any reason why Exchange (or any other application) would not function exactly the same as if the VMDK was residing on a FC or iSCSI backed LUN, or if a LUN was presented to the guest OS via an In Guest iSCSI initiator.
This is due to vSphere abstracting the underlying storage from the VM. To the operating system running within the guest the virtual hard disk appears and acts just like a local physical SCSI disk, regardless of the underlying storage protocol.
In support of this, Microsoft has a program called “Exchange Solution Reviewed Program” or “ESRP” which Microsoft partners can use to validate Exchange solutions. This program requires specific tests including one of24 hours using Jetstress with predefined settings, to validate the subsystem not only system performance, but consistency of the database.
Here is a Jetstress report showing the ESRP test passing with the following VM configuration with Exchange running within a VMDK on an NFS datastore
1 x Windows 2008 VM
1 vCPU (2.6Ghz)
24Gb vRAM
4 x PVSCSI Adapters
8 x VDMKs (2 per PVSCSI)
8 Exchange Databases (one per VMDK)
2 DAG Copies
The 24 Hour test can be viewed here -24 Hour Jetstress Test
The Databases checksum from the above 24 hour test can be viewed here -DB Checksum
Note: The above test was ran for the purpose of this post, to show the storage abstraction works for Exchange, not to demonstrate maximum performance for the underlying storage platform.
So if a vendor validates a VMDK on NFS implementation by successfully completing Microsoft’s official tests (via ESRP) is there any reason not to support it?
We believe Microsoft should provide some formal process to storage vendors to certify their solutions for Exchange, in the worst case, at least allowing vendors to submit hardware for validation using Microsoft’s internal certification/QA process where these tools cannot be shared publicly.
Please show your support for this issue by voting and leaving your constructive or encouraging feedback in the comments at the Microsoft Exchange Improvement Suggestions Forum below. This issue is already rated as the #1 issue so the more support the better!
So to Microsoft - and too all the Microsoft Exchange & Storage experts we ask;
1. Can you clarify by providing some form of documentation what the issue is with Exchange on NFS natively. The goal to ensure if there is an issue, its understood by the community
2. Can you clarify by providing some form of documentation what the issue is with Exchange storage in a VDMK on an NFS datastore (where the storage is abstracted by the hypervisor). The goal again is to ensure if there is an issue, its understood by the community and can possibly be addressed in future hypervisors.
3. If the support statement is simply outdated and needs updating, lets work together to make it happen for the good of all Microsoft’s customers, especially those who have NFS storage from one of the many vendors in the market.
Now for those customers experiencing this issue today, lets discuss the current workarounds available if you need to comply with the current support policy and the continued impact to Microsoft customers if the policy is not updated.
Option 1. Use in guest iSCSI initiators to present LUNs direct to the operating system
Issues
a) Increased complexity of managing two storage protocols (NFS + iSCSI), also some vendors license features like iSCSI at additional cost, so it makes it so expensive to purchase a license on the storage just to support Exchange.
b) Some storage solutions may not support NFS and iSCSI
c) Increased points of failure eg: iSCSI initiator
d) Potential for reduced storage capacity efficiency
e) No ability for the guest to take advantage of advanced storage features that are added to the vSphere storage stack.
Option 2. Present iSCSI LUNs to vSphere hypervisor
Issues
a) Increased complexity of managing two storage protocols (NFS + iSCSI) and additional cost as explained above.
b) Some storage solutions may not support NFS and iSCSI
c) Increased points of failure eg: iSCSI initiator
d) Potential for reduced storage capacity efficiency
Option 3. Run Exchange on physical hardware (not virtual)
Issues
a) Increased complexity of designing and managing another silo of compute/storage
b) Increased datacenter requirements which lead to increased OPEX (ie: Power/Cooling/Space)
c) Decreased ROI from physical hardware compared to virtualization
d) Decreased storage capacity efficiency
e) Increased CAPEX due to reduced flexibility in sizing physical hardware ie: Sizing for end state not current requirements
f) Delayed time to market / upgrades / expansion due to procurement of hardware
g) Increased hardware maintenance costs
h) Increased complexity for Disaster Recovery
It is clear based on the experience of the contributors of this article, that NFS has a large footprint in the market and for these customers using NFS, Microsoft should seek a mutual Win-Win situation for its large and small customers using NFS.
Microsoft should extend support for NFS backed storage deployments to facilitate and simplify Exchange deployments for customers using NFS storage, which without the updated support statement would likely be forced into using multi-protocol or standalone silo type deployment for Exchange, adding complexity and resulting in increased CAPEX/OPEX.
Let's hope Microsoft care about their customers as much as the authors of this document do!
EWS Bug in exchange 2013 CU2 and CU3
Hello,
we have found a special bug, known in the Exchange 2013 CU2 and CU3, CU1 was ok. And all other Exchange Versions, who's have just EWS like 2007 and 2010 are also ok.
We search from extern Email with the Operation FindItem with the Element Restriction for filter Emails. (message:ToRecipients and
message:CcRecipients).
Thank for a response
Bernd
Exchange 2007 OAB issues with web-deployment
Task 'mail user' reported error 0x8004010F: the operation failed. An object cannot be found.
This is connecting to an Exchange 2007 SP3 Rollup 12 (single server Exchange environment), running on a Server 2003 R2 SP2.
Found http://support.microsoft.com/kb/2845987 which discusses the need for web-based distribution.
Enabled this feature based on
http://www.outlookforums.com/threads/84204-outlook-2007-cached-mode-exchange-2010-cant-download-offline-address-book/
Yet we still continue to have an issue.
I rebuilt the OAB based on some recommendations, and it generated correctly. However we continue to have problems.
When disable my internet, my cache mode works for email, but there is no cached address book.
Based on research there appears to be many possible reasons related to this issue. I am trying to determine some avenues.
The following was informative:
http://blogs.msdn.com/b/dgoldman/archive/2006/08/25/how-exchange-2007-oab-files-are-replicated-to-a-client-access-server-for-download.aspx
Within it, it mentions to check application event logs for source MSExchangeFDS.
However there are none (since all roles are on same machine I am not sure if it would be applicable.
Additionally within the blog it discusses:
1. By default the OAB share on the OAB Generation server (local distribution point) will not be present. This directory gets created the first time the OAB Generation creates the Version 4 Offline Address List.
•Local directory [C:\Program Files\Microsoft\Exchange Server\ExchangeOAB]
•Unc path [\\ExchangeServerName\OAB\<GUID of OAB>]
2. Once the Distribution Point share has been created it will contain sub directories.
3. Each sub directory will be named with the the GUID of the Offline Address Book.
4. Each OAB directory will contain a set of files that will be downloaded by the client.
Well this directory has been in place for some time. Now, a new directory was created today when I enable the Web distribution. This is located at
C:\Program Files\Microsoft\Exchange Server\clientaccess\OAB
This path is identified in the properties of the OAB subsite within IIS.
When I compare the two directories, they both have the OAB.xml file (same GUID), and same modify date (which is 6/19/2010!)
Within the C:\Program Files\Microsoft\Exchange Server\clientaccess\OAB that is the only file. The Local directory [C:\Program Files\Microsoft\Exchange Server\ExchangeOAB also has thousands of LZX files.
Should these LZX files be in both locations?
Also, I find it strange that the modify date is 6/19/2010.
The blog above mentions that "All files in the directory will be specified in the oab.xml file. This is the file that the Outlook client will use so it can determine which OAB files it download. "
When I access the OAB xml file I do not see any listing of them, so I am wondering if there is something else going on?
Receiving 401 when using EWS with office 365
Hi - I am writing an app on a non Microsoft platform. I'm using the XML requests and sending HTTP POST requests directly to the server. Last week, everything was working fine. This week, I started getting 401 when I tried to POST the initial auto discover payload to https://autodiscover.<domain>.com/autodiscover/autodiscover.xml.
When I used the exchange test connectivity, it passes this part and is about to retrieve a message from the server. However, my code used to work and now returns 401. I'm not sure if something changed on the server side (I do not own the server).
I suspect maybe its the way I'm formatting my HTTP POST request, although exchange test connectivity does not show the request during the test (only the response). My Java app sets the following header:
Authorization: Basic user@domain.com:password
and I'm receiving the following error, which seems to indicate that there is something with the Authorization header. Does anyone know what is going on?
status code: 401, headers {"Content-Length" = 58;
"Content-Type" = "text/html";
Date = "Fri, 06 Jun 2014 07:07:52 GMT";
Server = "Microsoft-IIS/7.5";
"Www-Authenticate" = "NTLM, Negotiate, Basic realm=\"autodiscover.domain.com\"";
"X-Powered-By" = "ASP.NET";
}
[E2013][EWS-XML][EWSTOOL] Calendar item body not visible in outlook
Hi, after upgrading to Exchange 2013 SP1 we experience the issue that appointments created using EWS by our ERP application don't show the body in Outlook 2010/2013. The appointment body is only visible in OWA or on Active Sync devices. Outlook just shows an empty body text. When openening the appointment in OWA and editting the body text, by placing a '.' at the end for example, then the body text is visible in outlook again. This worked fine in CU3 and earlier.
I created a repro scenario using the EWSEditor tool:
https://ewseditor.codeplex.com/Create an appointment using EWS. Below the request I've sent to Exchange EWS. It creates an appointment on Saturday, March 8th from 22:00 to 23:00 with the following text in the body: ‘Plan the agenda for next week's meeting.’. The request is successful and the appointment is being created. However, the body text is only visible in Outlook Web App, not in Outlook.
I reproduced this issue in our lab also, so it’s not specific to our production Exchange server, but seems to be a general SP1 issue.
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Body>
<CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
SendMeetingInvitations="SendToAllAndSaveCopy" >
<SavedItemFolderId>
<t:DistinguishedFolderId Id="calendar"/>
</SavedItemFolderId>
<Items>
<t:CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<Subject>Planning Meeting</Subject>
<Body BodyType="Text">Plan the agenda for next week's meeting.</Body>
<ReminderIsSet>true</ReminderIsSet>
<ReminderMinutesBeforeStart>15</ReminderMinutesBeforeStart>
<Start>2014-03-08T22:00:00</Start>
<End>2014-03-08T23:00:00</End>
<IsAllDayEvent>false</IsAllDayEvent>
<LegacyFreeBusyStatus>Busy</LegacyFreeBusyStatus>
<Location>Conference Room 721</Location>
</t:CalendarItem>
</Items>
</CreateItem>
</soap:Body>
</soap:Envelope>
Frank.
Downloading Outlook Forms email using EWS
Hi,
I am trying to download the Outlook Forms emails as it is using EWS however the same is not happening. The Outlook Clas Property that I managed to identify by writing some logs is as below.
05/09/2014 06:05:01.875 - Login SuccessFull in Mail Box:shEBSFinanceEs ----------------- Mail Count is : 2
05/09/2014 06:05:02.406 - Mails Item Class Property Is :IPM.Note.Unclaimed Property Request
05/09/2014 06:05:02.593 - Login SuccessFull in Mail Box:shEBSFinanceEs ----------------- Mail Count is : 2
05/09/2014 06:05:02.624 - Mails Item Class Property Is :IPM.Note.Unclaimed Property Request
Appreciate the help!
Regards,
Roshan Rajan
EWS Managed API: Setting plain text is stripping XML tags
Hi,
I need to use Exchange managed api to send a plain text email, for which I'm using the following code:
_emailitem.Body = new MessageBody(BodyType.Text, somePlainText);
I thought this was working fine, but sometimes the text in someText might contain XML tags. E.g. The plain text needs to be:
"Hello world<END>FLAG</END>"
(This is because the email is getting sent to a special service and that service requires that the email is plaintext, but uses certain XML tags for special purposes).
Unfortunately, EWS appears to be stripping the tags! How can I send a simple plaintext email via EWS with the exact text I give it without EWS mangling the text?
Managing Exchange Mail Queus
Hi,
What should be done to manage the mail queue growth in exchange server 2010, suddenly sometimes my exchange server 2010 mail queues increases. What needs to be done for a smoooth process? why does this happen?
Sumanth.S Exchange Admin
[E2010,E2013][EWS][C#][Windows]: Change the synchronization status of a mail item
Get mailboxes permissions via EWS Exchange Web Services
I want to get who users that have the Send-As and Full-Access permissions on a mailbox. I can only access to the Exchange server through Exchange Web Servies.
I have already a powershell script who permits me to access to the Exchange via EWS. But I haven't found the function to get all the permissions.
Thanks a lot.
Exchange EDB Recovery Software to recover all lost database.
MS Exchange Server witnesses exchange of information in large volume in most large-scale organizations. Hence, corruption issues in Exchange Database (EDB) files are not uncommon. Even EDB files are damaged due to which mailbox data becomes inaccessible for the users. In such type of circumstances, only option is left is mounting the corrupt or damaged EDB offline database and recover the same into Outlook PST file format. In case offline EDB database gets corrupt or inaccessible, normally users manually convert them to access all important mails. Even though EDB file size is smaller and issue is minor, it works. But manual conversion of EDB to PST isn’t accurate in all cases. Also, this process eats a lot of valuable hours of your business. And this wastage of time can easily cost you more. Hence, it is always wise to perform all the recovery tasks of Exchange Server with EDB to PST Conversion utility that effortlessly performs these tasks within a while.
- Cost-cutting alternative to expensive recovery operations.
- Comprehensive solution of backup restoration, Exchange recovery, OST restoration and email searching.
- Reduces installation cost of any external hardware or third-party software.
- Helps user efficiently utilize all the available resources.
- Eliminates the need of monitoring and maintaining backup system in Exchange environment.
The EDB to PST Converter is a renowned conversion tool that performs successful operations with proper configuration. When it comes to install this utility, be sure to check your system’s configuration. Consider these basic requirements for flawless installation and operation of this software.FOR FREE trail demo LOG.in here:
http://www.filesrecoverytools.com/edb-to-pst-converter.html
Exchange 2007 In SCR Setup
We have MS Exchange 2007 +SP3 Setup. Two sites in exchange 2007 in Standalone mailbox, one is in Mumbai and another placed in chennai. We have enabled SCR on both Servers, both server having passive copy of each other databases.
Last Friday, there was some power failure issue at chennai data center. Due power failure, chennai mailbox server having hardware issue and doesn’t up now. We have activated chennai server database on Mumbai Server having each database size more than 30GB.
Now We are looking for High Availability in terms of database copy on local another server or how to activate them on in case if we freshly install exchange 2007 mailbox in chennai datacenter.
Please provide BEST Solution on this.
Get list of User Mailboxes in Exchange server 2013 by using EWS managed API
Hi all,
I need list of Users exists in my Exchange server 2013 , i.e Mail Box Users log in name.
i know the command in Powershell to get list, but i need this using code[ ews managed API].
How can i achieve this ?
Please share your ideas
Exchange server 2013 content filter rejecting all incoming messages as spam.
Hello All,
Today out of the blue our Exchange server 2013 install started rejecting any inbound message as spam. It first started with only one user not being able to receive any mail because of this anomaly and
then after 12 or so hours all users were getting their mail rejected.
I currently had the threshold set to 5 on external messages only. Internal is disabled.
I have tried setting the threshold to 8 and 9, and rebooted the server after restarting all services just to make sure everything reset. Even dished out a IISRESET just in case. Whatever I tried still does not work.
The install is a stand alone server facing the outside world (no edge server) living in a 2 domain controller environment with a share point farm thrown in (ESXI5.5 environment) Everything works just fine and dandy if I disable the content filter all together. Not seeing anything in the application logs out of the ordinary. Everything was working great and the same settings I used on this server worked well for a totally different server that runs just fine.
Any ideas?
fr0stsp1re
Get items in all Outlook folders using EWS (PowerShell)
Hi All,
I'm trying to figure out how to search all items in Outlook mailbox using EWS. I have a script that currently search "Sent Items" only. See script below. I just need to modify it to search all folders instead. Any help is appreciated. Thank you
$Report = @() #Provide text files for all users in the legal department $Law = cat law.txt #Set Date to 1 Year Ago $Date = (Get-Date).AddYears(-1) #Logon to Exchange Web Service with default credentials Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\1.2\Microsoft.Exchange.WebServices.dll" $sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value $user = [ADSI]"LDAP://<SID=$sid>" $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService -ArgumentList ([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP2) $service.AutodiscoverUrl($user.Properties.mail) Write-Progress -Activity "Preparing" -Status "Retrieving mailbox list" -PercentComplete 0 #Get Mailboxes for all users in the text file $Mailboxes = $law | Get-User | Select WindowsEmailAddress, Company $Count = $Mailboxes.Count #Go through each users found and process accordingly ForEach ($Mailbox in $Mailboxes){ $DisplayName = $Mailbox.DisplayName $i = $i + 1 $pct = $i/$Count * 100 Write-Progress -Activity "Collecting mailbox details" -Status "Processing mailbox $i of $Count - $DisplayName" -PercentComplete $pct Try { $Ok = $true $Mailbox = (Get-Mailbox $mailbox.WindowsEmailAddress -ErrorAction Stop ).PrimarySMTPAddress} catch [System.Exception]{ $Ok = $false } if ($Ok){ #Set EWS up to impersonationate user $ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId -ArgumentList ([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress),$Mailbox $service.ImpersonatedUserId = $ImpersonatedUserId #Open user folder and bind SentItems folder to the EWS service. $folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::SentItems,$Mailbox) $SentFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid) #Specify Search Filters: Specify Date and Message Class Type $Sfir = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsGreaterThanOrEqualTo([Microsoft.Exchange.WebServices.Data.EmailMessageSchema]::DateTimeSent, $Date) $Sfir2 = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.EmailMessageSchema]::ItemClass, "IPM.Note") #Add search filters together to form one search $sfCollection = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+SearchFilterCollection([Microsoft.Exchange.WebServices.Data.LogicalOperator]::AND); $sfCollection.Add($Sfir) $sfCollection.Add($Sfir2) #Create PropertySet to make it possible to retreive all properties of email content $psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties) $SentItemsview = new-object Microsoft.Exchange.WebServices.Data.ItemView(1000) $fiItems = $null #Loop through all all items in 1000 page increment until all items are processed Do { #Find Items based on folder Id, search filter and page view $fiItems = $Service.FindItems($SentFolder.Id,$sfCollection,$SentItemsView) #Create PropertySet to make it possible to retreive all properties of email content [Void]$service.LoadPropertiesForItems($fiItems,$psPropset) #Loop through each email item and retrieve recipients info. ForEach ($item in $fiItems) { $AllAttendees = $item.ToRecipients | Select -Expand Address $AllAttendees += $item.CCRecipients | Select -Expand Address $AllAttendees += $item.BCCRecipients | Select -Expand Address $sender = $item.From.Address $subject = $item.Subject $TimeSent = $item.DateTimeSent Write-Host "$Sender --- mailbox --- $TimeSent" for ($index = 0; $index -lt $AllAttendees.count; $index++) { Write-Progress -Activity "Looping" -Status "Going through all recipients list" -PercentComplete 0 $Attendees = $AllAttendees[$index] #Filter invalid users, external users and users in Legal department If ($Attendees -like "*domain.com"){ If ($Law -notcontains $Attendees){ $a = Get-User $Attendees -filter {Company -ne $null} -ErrorAction SilentlyContinue if ($a){ $Obj = New-Object -TypeName PSObject $Obj | Add-Member -MemberType NoteProperty -Name Subject -Value $subject $Obj | Add-Member -MemberType NoteProperty -Name Sender -Value $sender $Obj | Add-Member -MemberType NoteProperty -Name Sent -Value $TimeSent $Obj | Add-Member -MemberType NoteProperty -Name Recipients -Value $Attendees $Report += $Obj } } } } } $SentItemsView.Offset += $fiItems.Items.Count } While ($fiItems.MoreAvailable -eq $true) } } #Export report to CSV $Report | Export-Csv "C:\Users\user\Dropbox\Script\LawData.csv" -NoTypeInformation -Encoding UTF8
Tunde
2010 EWS 2.0 C# Windows 7: "Data is Corrupt" error, but only when forwarding messages from a certain user
I have an application that is basically a mailing list manager. New messages are sent to an Exchange mailbox, from outside of our organization. Periodically the application runs, scans the mailbox for new messages, and forwards them to the appropriate users. For the most part this works fine, but messages that come from a specific outside user cause a "Data is Corrupt" message.
I have tried re-creating the messages that cause problems, both using Outlook and using a Gmail account. In both instances, the message went through the system with no problems. But this vendor is doing something that is causing me grief.
I've included some sample code below. What I would really like are tips for debugging these kinds of problems. It seems to me that "Data is Corrupt" is sort of a generic error.
private void ForwardMessage(EmailMessage msg, List<String> recipients, String replyTo)
ResponseMessage stepOne;
EmailMessage stepTwo;
Folder drafts;
ConversationId cid;
/*
* This is a little screwy.
* EmailMessage.CreateForward() is really useful, because it preserves
* attachments. But it mangles the message body and subject, so I have reset those.
* And it doesn't support setting the Reply To, so I have to do this
* in two steps: create the forward, save to Drafts, then get the
* message in the Drafts forward, and set the Reply To.
*/
cid = msg.ConversationId;
stepOne = msg.CreateForward();
stepOne.Body = msg.Body;
stepOne.Subject = msg.Subject;
foreach (String s in recipients)
{
stepOne.BccRecipients.Add(s);
}
stepOne.Save(WellKnownFolderName.Drafts);
/*
* There is a chance, though small, that another process
* could create a draft message in response to the message
* I'm in the process of forwarding. But it is unlikely,
* so I'm going to live with this. Extended Properties would
* be the safer way to do this, but I couldn't get them
* to make the trip.
*/
stepTwo = null;
drafts = Folder.Bind(msg.Service, WellKnownFolderName.Drafts);
foreach (EmailMessage em in drafts.FindItems(new ItemView(100)))
{
if (em.ConversationId.Equals(cid))
{
stepTwo = em;
}
}
if (stepTwo != null)
{
stepTwo.ReplyTo.Add(replyTo);
// This next line is where the "Data is Corrupt" error keeps happening
stepTwo.SendAndSaveCopy();
}
}