K B
asked on
PowerShell: EWS script works great if I have FullAccess permissions to each mailbox/ why not with impersonation?
I do not want to grant an account full access to each mailbox. I get errors only when I try to run impersonating mailbox.
I validated with Get-ManagementRoleAssignme nt -Role applicationimpersonation that I have the proper Role
I am effectively using this script https://emg.johnshopkins.edu/?p=837 against Office 365
For Office 365, I have added this line:
I get this error if I don't have full access to the mailbox:
Thank you.
I validated with Get-ManagementRoleAssignme
I am effectively using this script https://emg.johnshopkins.edu/?p=837 against Office 365
For Office 365, I have added this line:
$service.Credentials = new-object Microsoft.Exchange.WebServices.Data.WebCredentials -ArgumentList "admin@contoso.onmicrosoft.com", "Password123"
I get this error if I don't have full access to the mailbox:
Exception calling "Bind" with "2" argument(s): "The specified folder could not be found in the store."
At C:\scripts.new\Get-EWSCalendar.ps1:39 char:9
+ $Calendar = [Microsoft.Exchange.WebServices.Data.Folder]::Bin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ServiceResponseException
Exception calling "FindAppointments" with "2" argument(s): "The element at position 0 is invalid
Parameter name: parentFolderIds"
At C:\scripts.new\Get-EWSCalendar.ps1:51 char:9
+ $fiItems = $service.FindAppointments($Calendar.Id, $CalendarV ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentException
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Open in new window