Using EWS to cancel a meeting in a room mailbox.

This seems like a common occurance at any company but there really doesn't seem to be a solution for it.  In Exchange people can reserve a conference room by inviting it to a meeting and with the proper setup the room mailbox will accept the meeting
if the time slot is free.  The problem comes in when the organizer of the meeting leaves the company.  I'm working on a project using Exchange Web Services to clean out our room mailboxes of meetings which were scheduled by people who are no longer
at the company.  The only way I know how is through web services and through an account that has been given the impersonation right (which I am using).
The problem I'm having is that through web services there is a method on an appointment item called CancelMeeting which would do just this except I'm getting the below error:
Exception calling "CancelMeeting" with "0" argument(s): "User must be an organizer for CancelCalendarItem action."
I'm looking for any suggestions as I've been looking out over the Internet for quite a bit now and not really coming up with anything of use.  Below is the code I'm using (cleaned up to remove company information).  Any thoughts or input that could
be helpful would be much appreciated.
#Address of object to connect to
$roomAddress = '[email protected]'
#Path to the EWS DLL
$dllpath = "C:\Program Files\Microsoft\Exchange\Web Services\1.2\Microsoft.Exchange.WebServices.dll"
#Load the EWS DLL
[void][Reflection.Assembly]::LoadFile($dllpath)
#Create a service object that supports Exchange 2010 SP1
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP1)
#Store the passed in credential
#$service.Credentials = $credential
#Web services url
$uri=[system.URI] "https://ExhcangeServer.Contoso.com/EWS/Exchange.asmx"
$service.Url = $uri
#The impersonation details.
$ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId
$ImpersonatedUserId.IdType = 'smtpaddress'
$ImpersonatedUserId.Id = $roomAddress
$service.ImpersonatedUserId = $ImpersonatedUserId
#Build a folder ID object
$folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,$roomAddress)
#Bind to the mailbox and folder.
$CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($service,$folderid)
#Get up to 2000 entries from the folder and find any that are appointments from today and the next 5 days.
$startDAte = get-date
$endDate = (get-date).AddDays(+5)
$cvCalendarview = new-object Microsoft.Exchange.WebServices.Data.CalendarView($StartDate,$EndDate,2000)
$frCalendarResult = $CalendarFolder.FindAppointments($cvCalendarview)
#Build a view
$psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$psPropset.RequestedBodyType = [Microsoft.Exchange.WebServices.Data.BodyType]::Text
#Cancel the first meeting found (there is one here)
$frCalendarResult.Items[0].CancelMeeting()

Oh, ouch. In that case, I might also try asking in the Exchange development forum. They're a bit more versed in EWS than I am.
http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopmentlegacy/threads
I do have a script that uses EWS to set a delegate on a specific calendar (it was written for standard users, not sure how it'll handle room mailboxes. Perhaps delegate rights will be enough to send out cancellation notices. I can clean it up and post it
(after I get out of this afternoon meeting) if you think it might help.

Similar Messages

  • Disappearing Notes in Meeting Requests with Room Mailboxes

    We are running Exchange 2010 SP3. We observe this behavior with both Outlook 2010 and 2013.
    When a user creates a new meeting request for a moderated room, the notes only show up on the organizers request (in their Outlook calendar pending), but the delegate cannot view the notes. There is information contained in the notes that will aid the delegate
    in approving or denying the meeting request in the various Rooms.
    How can I make it so that the Notes in the Meeting Request are viewable by the delegate?
    Thanks in advance!

    Hi,
    Do you mean you want to set a delegate for room mailbox for meeting request approving? If it is, we can run the following command in Exchange server to achieve it:
    Set-CalendarProcessing -Identity "Room222" -ResourceDelegates
    [email protected]
    For more information about it, please refer to:
    http://technet.microsoft.com/en-us/library/bb124973(v=exchg.141).aspx
    Regards,
    Winnie Liang
    TechNet Community Support

  • [E2010][EWS-XML][JAVA]How to get the properties of meeting rooms in Exchange 2010 using EWS Java API

    When you look at meeting room properties in Outlook 2010, you can see 'City', 'Country/Region' and 'Department' information.
    Is there any way to get this information using EWS Java API? 

    Hi Glen,
    I am able to understand what u have said, but do not know how to implement it with meeting rooms....
    If i am implementing
    "Get all appointments between startDate and endDate in the specified folder, including recurring meeting occurrences" in ews-java-api, as you have mentioned above, i am able to get only my appointments from the start date to end date , as i
    have given my email id and password, how to get my organization meeting room details, booked or not.
    static ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
    public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    ExchangeCredentials credentials = new WebCredentials("[email protected]", "zzzz");
    service.setCredentials(credentials);
    try {
    System.out.println("Check");
    service.autodiscoverUrl("[email protected]",new RedirectionUrlCallback());
    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    NameResolutionCollection nameResolutions = service.resolveName("SDB1",ResolveNameSearchLocation.DirectoryOnly, true);
    System.out.println("nameResolutions==="+nameResolutions.getCount());
    for(NameResolution nameResolution : nameResolutions)
    System.out.println("NAME==="+nameResolution.getContact().getDisplayName());
    The above code gives me the output like, the meeting room in my organization with word SDB1 are
    Output:
    nameResolutions===2
    NAME===SDB1- TELCON - 1
    NAME===SDB1-TELCON - 2
     for. eg. I need to know today at what are the appointments in the room SDB1-TELCON2 and who all have booked the room.
    I do not know how to implement for the meeting room can you please help me how to give it.
    Thanks in advance.

  • How To Create Lync Online Meeting Using EWS

    Does anyone know how to create a Lync Online Meeting Using EWS (Exchange Web Service API). The exchange version I'm using is 2010 SP2. 
    I'm able to successfully create a regular meeting/appointment using EWS and now I'm trying to create a lync online meeting using EWS which will incorporate the lync online meeting URL in the invite that gets send out to attendees. 
    I'm using C#. I have try setting the Appoinment IsOnlineMeeting property to true but I'm not seeing any changes it is having. I see that the Appointment object also has a JoinOnlineMeetingUrl property which I have tried to use but I got an exception because
    my exchange version is 2010 and it requires the 2013 version. 
    I've been researching this for a couple of days now and I've yet to find a solution for it. Any help would be appreciated.
    Thanks,

    Hi.
    I see that you have the same problem. I'm trying to create an online meeting with EWS (or UCMA 3.0?) without results. Have you resolved? Can you post your code?
    Thanks in advance.

  • Outlook 2010 - Cannot cancel a meeting as the organizer.

    On Outlook 2010 I do not have a 'Cancel Meeting' option. I can delete a meeting but the only option is to notify the organizer...  but I am the meeting organizer. I need to be able to cancel a meeting and notify all of the attendees. I currently do
    not have (or cannot find) this option!

    This happens after activesync. If you disable activesync for problematic user's mailbox, calendar didn't change meeting organizer (cancel, update meeting buttons).
    I found that - after meeting organizers mobile phone (nokia) synchronization,
    some values of meeting organizer was changed.
    You can look and compare organizer values (before and after sync)here:
    Kareldev - MSFT
    Microsoft
    MSFT
    40 Points 4 0
    0
    Recent Achievements
    Forums Answerer I First Marked Answer
    First Answer Confirmed
    Kareldev - MSFT's threads
    View Profile
    Microsoft
    (MSFT)
    40 Points
    1
    Vote As Helpful
    rgould5,
    There are three MAPI properties that Exchange clients can key off of for determining organizer information.  Here’s a quick summary
    of what they are with details on how to inspect them using the  MFCMAPI tool mentioned by Ripu:
    1.      
    For meeting requests, a Recipient table exists showing each attendee.  The organizer is represented here when PR_Recipient_Flags = 3
    2.      
    PR_ Sent_Representing_Email_Address and/or PR_Sender_Email_Address
    3.      
    named prop0x8217 dispidapptstateflags [can also show up as MessageStatus]
    if the value is 1 = olMeeting it means you’re the organizer
    if the value is 3 = olMeetingRecieved it means you received the item so you can’t possibly be the organizer
    In your situation, the organizer seems to be modified on the calendar item in all three users’ mailboxes at the same time.  This
    usually means an application that has privileges to each mailbox is the culprit.  Generally, if ActiveSync or an ActiveSync device is contributing to the problem, only the mobile device user’s calendar item would be affected.
    The best approach is to inspect which organizer attributes are changed on each person’s calendar item.  Then, with careful repro steps, see if
    you can identify the user or service account that is making the changes.  Take a look at the examples below:
    Here’s the details of what Recipient Table looks like [requires MFCMAPI available
    http://mfcmapi.codeplex.com from a PC with Outlook].  This isn’t a user friendly tool, but it’s very helpful in identifying what’s changed. 
    When you first launch the tool, select the menu item
    Session, Logon and Display Store Table.
    Now select an Outlook profile to login with
    If you see
    Mailbox - <username> in the list of display names you’re doing good.  Double-click this to launch the next window.
    In this window, drill into the mailbox 
    MFCMAPI Recipient Table
    -To find the appointment you’re troubleshooting, go to the calendar folder underneath IPM_SUBTREE.  Sorting by Subject will usually help get to
    item quickest.  Select the item, and Action Menu(?) / and Display Attachment table.    You will see a list of recipients in a new window.  There should be a "3" in the PR-RECIPIENTS_FLAGS columb for the organizer.
    - A healthy recipient table - the PR_RECIPIENT_FLAGS indicates whether a recipient is the organizer, or an attendee [this column is actually all the
    way to the right ].  When the PR_RECIPIENT_FLAGS = 3, that indicates the organizer.  For example, if the delegate organized a meeting with the manager and E2k7 Native being the required attendees. PR_Recipient_Flag should be 3 for the Delegate. 
    If not, then the calender item was modified by something.
    - Going back to the calender item,
    PR_SENDER_EMAIL  shows Distinguished Name (DN) of the sender.
    - Ok.  Back on the calender item, if the organizer is listed as wrong person, look to see the last person to modify the item.  Here’s
    where you can find out what account last modified the calendar item.   Look at the Column "Property Names" for row PR_Last_Modifier_Name.  This is the account that last modified the item and is probably the culprit. 
    I hope this helps!

  • HT4009 I purchased hipstamatic the other day due to an ad I read.  When I tried to use it, it didn't meet my expectations. I'm not going to use it at all. How can I apply for a refund please?  Thank you!

    I purchased hipstamatic app the other day. When I tried to use it, it didn't meet the expected features it advertised. How can I ask for a refund?

    If it's not workins as described in the store then you can try the 'report a problem' link from your purchase history : log into your account on your computer's iTunes via Store > View My Account and you should then see a Purchase History section with a 'see all' link to the right of it ; click on that and you should see a list of your purchases ; find that app and use the 'Report a Problem' link and fill in details about the problem (iTunes support should reply within, I think, 24 to 48 hours).
    Some people have had a problem with the 'report a problem' link (it's been taking people to this site on a browser instead of showing a form in iTunes) - if it does that to you then try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page.

  • Using Outlook (2010 & 2013) to connect to Exchange using EWS

    First things first.
    I know that Outlook on the PC platform uses MAPI to connect to Excahnge while the Mac flavor of Outlook uses EWS, however, i was cycling through some available EX and ExO PowerShell cmdlets and found a parameter for set-casmailbox named EWSAllowOutlook Which
    leads me to believe that configuring this setting should allow Outlook to use EWS to connect to Exchange. (This is a separate parameter from EWSAllowMacOutlook).
    I tried a manual configuration (entering in the EWS url and setting the correct Outlook Anywhere settings) with no success.
    I also tried manual configuration of an outlook.com and activesync account and entering the EWS URL as well with no success.
    Has anyone successfully configured Outlook for PC to connect to Exchange using EWS and how did you configure the client?
    Thanks

    Hi,
    Sorry for the late reply.
    About the EWSAllowOutlook parameter, I have something to clarify.
    This parameter allow or disallow Outlook 2007 to access EWS for the user.
    Outlook uses EWS for free/buzy, OOF settings, and calendar sharing.
    Outlook connect to Exchange server by using MAPI is a by design behavior.
    We cannot change this.
    Hope it is helpful
    Thanks
    Mavis
    Mavis Huang
    TechNet Community Support

  • Using EWS to work with mail items from a range derived from Get-Date

    I am attempting to write a powershell script that uses EWS to move items from the prior month and create a folder named after that month to hold those items. 
    I am finding that the search filter only likes the format if you use .NET system.DateTime and not Get-Date.
    However it's strange, for testing I configured my variable to be the exact same format as the .NET format but it rejects it. 
    The error i receive is: 
    Exception calling "FindItems" with "2" argument(s): "The specified value is
    invalid for property."
    At line:1 char:1
    + $frFolderResult = $InboxFolder.FindItems($sfCollection,$view)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ServiceResponseException
    For example, if i set $startdate and $enddate like this  $startdate=(([system.DateTime]::Today.AddDays(-60)))
    $startdate returns Monday, January 20, 2014 12:00:00 AM, and the search filter works fine.
    but if i set $startdate using this: $startdate = (Get-Date).AddMonths(-1).ToString("dddd, MMMM 01, 12:00:00 AM")
    It gets rejected event though the output is exactly the same.
    i.e. Friday, February 01, 2014 12:00:00 AM
    Any help would be appreciated. 
    Thank You. 
    #Set the mailbox that this script will run against
    $MailboxName = "[email protected]"
    # Set up the API dll path, AutoDiscover URL and AD account used to access the mailbox
    Import-Module "C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll"
    $service = new-object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::"Exchange2010_SP2")
    $windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
    $sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
    $aceuser = [ADSI]$sidbind
    $service.AutodiscoverUrl($aceuser.mail.ToString())
    # Determine if the script is running in January in order to set the year used in the search filter
    if ((Get-Date).Month -eq 1) {
    $searchyear = (Get-Date).Year - 1
    Else{
    $searchyear = (Get-Date).Year
    # Set variables for the search filter to move items from the prior month to a folder
    $startdate = (Get-Date).AddMonths(-1).ToString("dddd, MMMM 01,")
    $startdatetime= "$startdate $searchyear 12:00:00 AM"
    $enddate = [System.DateTime]::DaysInMonth($(Get-date).Year, $(Get-date).Month -1)
    $priormonth = (Get-Date).AddMonths(-1).ToString("dddd, MMMM")
    $enddatetime = "$priormonth $enddate, $searchyear 11:59:59 PM"
    # Set up folder path locations for the search filter
    $folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$MailboxName)
    $MailboxRoot = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot,$MailboxName)
    $InboxFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)
    # Create the search filter
    $Sfgt = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsGreaterThan([Microsoft.Exchange.WebServices.Data.ItemSchema]::DateTimeReceived, $startdatetime)
    $Sflt = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsLessThan([Microsoft.Exchange.WebServices.Data.ItemSchema]::DateTimeReceived, $enddatetime)
    $sfCollection = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+SearchFilterCollection([Microsoft.Exchange.WebServices.Data.LogicalOperator]::And);
    $sfCollection.add($Sfgt)
    $sfCollection.add($Sflt)
    # Perform the search
    $view = new-object Microsoft.Exchange.WebServices.Data.ItemView(5000)
    $frFolderResult = $InboxFolder.FindItems($sfCollection,$view)
    # define the destination folder name, check if the destination folder exists
    $foldermonth = (Get-Date).AddMonths(-1).ToString("MM")
    $newFolderName = "$foldermonth$searchear"
    $fvFolderView = new-object Microsoft.Exchange.WebServices.Data.FolderView(10)
    $SfSearchFilter = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.FolderSchema]::DisplayName,$newFolderName)
    $findFolderResults = $service.FindFolders($MailboxRoot,$SfSearchFilter,$fvFolderView)
    # Create the destination folder if necessary
    if ($findFolderResults.TotalCount -eq 0){
    $NewFolder = new-object Microsoft.Exchange.WebServices.Data.Folder($service)
    $NewFolder.DisplayName = $newFolderName
    $NewFolder.Save($MailboxRoot.Id.UniqueId)
    else{
    # Folder Already Exists - Do Nothing
    # Move the items in to the destination folder
    foreach ($miMailItems in $frFolderResult.Items){
    "Moving" + $miMailItems.Subject.ToString()
    [VOID]$miMailItems.Move($NewFolder.Id.UniqueId)

    The Managed API is expecting you to pass a Typed Value not a String so if you just use
    $startdatetime= [System.DateTime]::Parse("$startdate $searchyear 12:00:00 AM")
    That should work okay, the Managed API itself will then covert it to and from UTC and then submit the query eg
    <m:Restriction>
    <t:IsLessThan>
    <t:FieldURI FieldURI="item:DateTimeReceived" />
    <t:FieldURIOrConstant>
    <t:Constant Value="2014-02-24T03:26:34.889Z" />
    </t:FieldURIOrConstant>
    </t:IsLessThan>
    </m:Restriction>
    Which you can see yourself if you enable tracing eg
    $service.TraceEnabled = $true
    Cheers
    Glen

  • Using Jabber to initiate a Meet-me conference

    Hi Guys,
    we have a Cisco US 9 environment. but no physical phone. we only use Jabber.
    Is there a way to use Jabber to initiate a Meet me conference?
    Regards
    Rassoul

    Unfortunately, this is not possible from Jabber.
    -Bill (http://ucguerrilla.com)

  • How to get list of Users[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 login name.
    I was  created Full Access permissions of all users to Admin user account,  to access each user Mailbox programatically 
    i need the list of Mailboxes in exchange server .
    MailBox  mailbox = new MailBox("user");
    Please share your ideas

    Hi,
    We can run the following command in Exchange Management Shell to get all user mailboxes name and export it to a .csv file:
    Get-Mailbox -ResultSize Unlimited | Select Name,Alias,RecipientTypeDetails | Export-Csv c:\Users.csv
    If you want to retrieve the list of users by using EWS Managed API, I suggest you can ask a question in Exchange Development forum for more suggestion:
    http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads
    Regards,
    Winnie Liang
    TechNet Community Support

  • Export a mail as PST file using EWS API

    Hi,
    I need to export the Exchange mails to PST file without installing the outlook. To acheive this i am choosing the EWS API. but i dont know how to do that. So, now i have a two questions, the first one, is it possible to create the pst file using EWS API?.
    If yes, how to create a pst file using EWS, if any one posted the sample code here, it is very helpful for me.
    Thanks,
    RamMohan

    EWS is not going to help you do what your trying to do, EWS is an Exchange API so you need to have an Exchange 2007 server or greater with the MailStore mounted to even use it to access the Mailbox . EWS also doesn't support exporting email to a PST because
    the PST file is an Office file format so in the case where you do manage to mount the database on Exchange then use Adam's suggestion or just connect via Outlook and export the Mailbox.
    >> I am parsing the mails from the exchange EDB files
     With what ? reading the contents of an EDB file directly is not supported although there are a few third party apps that can do it and if your using one of those apps then all of them I've seen support the export to PST (unless your using a Trial licence). 
    The correct method of recovering data from an EDB file would be to use a Recovery Database
    https://technet.microsoft.com/en-us/library/dd876954(v=exchg.150).aspx even if you don't have access to the environment you should be able to setup a temp environment using Virtual machines and recover it that way.
    Cheers
    Glen

  • 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

    It seems the answer is here:
    http://gsexdev.blogspot.com/2011/08/using-allitems-search-folder-from.html.
    I'll go through it and let you if successfully.
    Thanks
    Tunde
    Tunde

  • MIME content conversion failed error while processing "550 5.6.0" NDR using EWS API

    While trying to process journal report having "550 5.6.0" NDR with the following content using EWS API
    *Delivery has failed to these recipients or groups:
    [email protected] ([email protected])
    The email system had a problem processing this message. It won't try to deliver this message again.
    [email protected] ([email protected])
    The email system had a problem processing this message. It won't try to deliver this message again.
    [email protected] ([email protected])
    The email system had a problem processing this message. It won't try to deliver this message again.
    Diagnostic information for administrators:
    Generating server: ALMPR02MB001.namprd05.prod.outlook.com
    [email protected]
    Remote Server returned '550 5.6.0 M2MCVT.StorageError; storage error in content conversion'
    [email protected]
    Remote Server returned '550 5.6.0 M2MCVT.StorageError; storage error in content conversion'
    [email protected]
    Remote Server returned '550 5.6.0 M2MCVT.StorageError; storage error in content conversion'
    Original message headers:
    Received: from ALMPR02MB001.namprd05.prod.outlook.com ((11.255.110.102)) by
    ALMPR02MB001.namprd05.prod.outlook.com ((11.255.110.102)) with
    ShadowRedundancy id 15.0.851.11; Fri, 24 Jan 2014 12:20:42 +0000
    Received: from AN2PR05MB011.namprd05.prod.outlook.com (10.255.202.146) by
    ALMPR02MB001.namprd05.prod.outlook.com (11.255.110.102) with Microsoft SMTP
    Server (TLS) id 15.0.851.11; Wed, 22 Jan 2014 19:25:20 +0000
    Received: from AN1PR05MB018.namprd05.prod.outlook.com ([159.254.10.28]) by
    AN1PR05MB018.namprd05.prod.outlook.com ([159.254.10.28]) with mapi id
    15.00.0851.011; Wed, 22 Jan 2014 19:25:19 +0000
    Content-Type: application/ms-tnef; name="winmail.dat"
    Content-Transfer-Encoding: binary
    From: "Aron,Shakton"
    To: "[email protected]" ,
    "[email protected]" , "[email protected]"
    Subject: Updated: Drive # 3
    Thread-Topic: Updated: Drive # 3
    Thread-Index: AQHPF6evINDh6QBmQ0OJyeaK0OyWzQ==
    Date: Wed, 22 Jan 2014 19:25:18 +0000
    Message-ID: <[email protected]ok.com>
    Accept-Language: en-US
    Content-Language: en-US
    X-MS-Has-Attach: yes
    X-MS-TNEF-Correlator: <[email protected]ok.com>
    MIME-Version: 1.0
    X-Originating-IP: [::]
    Return-Path: [email protected]
    X-Forefront-PRVS: 01018CB5B3
    X-Forefront-Antispam-Report:
    SFV:NSPM;SFS:(10019001)(6009001)(199002)(189002)(377454003)(2656002)(81816001)(81686001)(54316002)(49866001)(63696002)(65816001)(16799955002)(74876001)(47976001)(77982001)(81342001)(79102001)(94316002)(76576001)(56776001)(47736001)(50986001)(85852003)(54356001)(77096001)(74316001)(53806001)(69226001)(80976001)(4396001)(51856001)(83322001)(93136001)(85306002)(46102001)(19580395003)(74662001)(15975445006)(74706001)(15202345003)(76786001)(59766001)(83072002)(81542001)(76176001)(76796001)(87936001)(87266001)(92566001)(2201001)(47446002)(93516002)(33646001)(90146001)(31966008)(56816005)(74366001)(86362001)(24736002)(3826001);DIR:OUT;SFP:1102;SCL:1;SRVR:ALMPR02MB001;H:AN2PR05MB011.namprd05.prod.outlook.com;CLIP:::;FPR:;RD:InfoNoRecords;A:0;MX:1;LANG:en;*
    I am getting the following error.
    ERROR Message: MIME content conversion failed.
    Stack Trace : at Microsoft.Exchange.WebServices.Data.ServiceResponse.InternalThrowIfNecessary()
    at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalGetAttachments(IEnumerable`1 attachments, Nullable`1 bodyType, IEnumerable`1 additionalProperties, ServiceErrorHandling errorHandling)
    at Microsoft.Exchange.WebServices.Data.ExchangeService.GetAttachment(Attachment attachment, Nullable`1 bodyType, IEnumerable`1 additionalProperties)
    Has anyone faced this issue? how s/he got past this?
    Regards
    Call
    Send SMS
    Add to Skype
    You'll need Skype CreditFree via Skype

    Mokchhya-
    I responded to your
    StackOverflow post as well, but I'll respond here as well.
    Are you using Exchange Server 2010 SP3 RU2? If not, that might fix the issue. Another poster ran into a similar error and they were also sending an email with an attachment:
    http://social.technet.microsoft.com/Forums/en-US/fd7ef80e-f80b-47ed-883b-a34511c6233c/a-storage-transient-failure-has-occurred-during-content-conversion?forum=exchangesvrsecuremessaginglegacy.
    The support page related to the fix is here:
    http://support.microsoft.com/kb/2863310.
    -Mimi

  • Getting email notifications using EWS streaming notifications for a shared mail box

    Hi,
    I have been trying to get email notification for a shared mailbox using EWS streaming notifications. i am unable to get the notifications. Please can any one tell me how this task can be achieved.
    -Praveen

    I would recommend you to this link
    http://blogs.msdn.com/b/emeamsgdev/archive/2013/04/16/ews-streaming-notification-sample.aspx
    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora

  • How To Get Deleted Item Count and Associated Item Count And LastLogOn and LogOff Time For A Mailbox In Exchange Using EWS

    Using Powershell cmdlet i get  all the details..But i want to get these Details by using EWS Managed Api.Is It Possible to do???
    Powershell Cmdlet,
    Get-MailboxStatistics -Identity Username, Using this cmdlets all the details will get displayed.
    DeletedItemCount:5 //Here how this count comes.In My OutlookWebApp the deleteditems folder contains 13 items in it..But the count shows only 5.
    TotalDeletedItemSize:5.465 Kb//Even this value too does not match with DeletedItems Folder size in owa.
    AssociatedItemCount:12
    LastLogOnTime:11/11/11 12:43PM
    LastLogOff Time:11/11/11 2:43PM
    In EWS,
    By Looping through all folders i can get the total item count and total item size.Even i can get deleteditems  count .But that value does not match  With the powershell value.Even the TotalDeletedItemSize
    Doesnt match.
    Using EWS Managed Api ,Looping through folders i can get ItemCount,TotalitemSize,(DeletedItems,TotalDeleteditemSize(These TwoValues Does not match with values comes from powershell))
    Now how to get the Associated item count and lastlogoff and logon time using EWS managed Api.Is it Possible???
    And even y the deleteditems count and size values varies between EWS and powershell.

    What happens if you execute the below code?
    Get-MailboxFolderStatistics [email protected] | where {$_.FolderPath -like "/Deleted Items"}
    Refer this blog. You may get some dice
    http://exchangepedia.com/blog/2008/09/configuring-deleted-item-retention.html
    Regards Chen V [MCTS SharePoint 2010]

Maybe you are looking for