I have verified that the user account (the service) can log into OWA and read the contents of the "targetEmail".
The only difference is that I'm now using an Exchange 2013 CAS server. When I use Exchange 2013, I get the following:
The remote server returned an error: (403) Forbidden.
Do I need to do anything special for Exchange 2013?
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, targetEmail);
var fldsList = GetSubFolders(targetEmail,WellKnownFolderName.MsgFolderRoot);
//
//
FindFoldersResults folderResults = null;
var Propset = new PropertySet(BasePropertySet.FirstClassProperties);
Propset.Add(PR_MESSAGE_SIZE_EXTENDED);
var folderView = new FolderView(100);
folderView.PropertySet = Propset;
try
{
folderResults = service.FindFolders( WellKnownFolderName.MsgFolderRoot, folderView);
}
catch (ServiceResponseException e)
{
// If no voicemail folder, archive etc.
}