Searching for calendar items older than a specific date with search-mailbox and AQS

I need to find the total size of all calendar items in a mailbox older than a specified date using PowerShell through the search-mailbox cmdlet's searchquery parameter.  My problem is that I cannot find a complete list of Calendar item properties to
use in search queries.  The AQS page doesn't have a complete list of properties for a Calendar object.
I'm using code from the ArchiveStatisticsPlanner.ps1 script as a base and the only date properties I know of are the sent and receive properties (see below.)  The basic start, end, date properties generate errors in the query.  How can I find all
Calendar items older than say, 1/1/2013?
Sample:
$MBXSearch=Search-Mailbox-Identity$MBX-SearchQuery"kind:calendar
sent:<=$QueryDate OR kind:calendar received:<=$QueryDate"-EstimateResultOnly-DoNotIncludeArchive

huh, you a get response marked as answer that wasn't very helpful.
EDIT: and now I'm reported as abusive.  Please don't tell the truth on these forums, it seems to be frowned upon
I did that.
If you're going to necro an answered thread and attempt to hijack it, you should have an actual answer that you feel is more relevant.
All you did was complain and add zero useful information, thus earning an 'offtopic/irrelevant' notation.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing)

Similar Messages

  • Set restriction to get messages older than a specific date using EWS?

    Hi, I'm new working with EWS and I have found some code to set a restriction to help me filter messages "between" to dates, but I need to be able to obtain emails that are "older" than a specific date so I can delete them.  My application needs to be
    able to clean up a mailbox to only to keep up to so many days/weeks worth of emails.  The code I have to search for emails that works
    between dates is:
    public void SetDateRestriction(FindItemType findItemRequest)
    DateTime dateStart = DateTime.Now;
    DateTime dateEnd = DateTime.Today.AddDays(-180);
    PathToUnindexedFieldType dateSentPath = new PathToUnindexedFieldType();
    dateSentPath.FieldURI = UnindexedFieldURIType.itemDateTimeSent;
    IsGreaterThanOrEqualToType isGreaterThanOrEqual = new IsGreaterThanOrEqualToType();
    isGreaterThanOrEqual.Item = dateSentPath;
    FieldURIOrConstantType dateConstant = new FieldURIOrConstantType();
    ConstantValueType dateConstantValue = new ConstantValueType();
    //dateConstantValue.Value = string.Format("{0}-{1}-{2}T00:00:00Z", dateStart.Year.ToString(), dateStart.Month.ToString(), dateStart.Day.ToString());
    dateConstantValue.Value = dateStart.ToUniversalTime().ToString("yyyy-MM-ddT00:00:00Z");
    dateConstant.Item = dateConstantValue;
    isGreaterThanOrEqual.FieldURIOrConstant = dateConstant;
    // less than or equal to
    PathToUnindexedFieldType dateSentPath1 = new PathToUnindexedFieldType();
    dateSentPath1.FieldURI = UnindexedFieldURIType.itemDateTimeSent;
    IsLessThanOrEqualToType lessThanOrEqualTo = new IsLessThanOrEqualToType();
    lessThanOrEqualTo.Item = dateSentPath1;
    FieldURIOrConstantType dateConstant1 = new FieldURIOrConstantType();
    ConstantValueType dateConstantValue1 = new ConstantValueType();
    //dateConstantValue1.Value = string.Format("{0}-{1}-{2}T00:00:00Z", dateEnd.Year.ToString(), dateEnd.Month.ToString(), dateEnd.Day.ToString());
    dateConstantValue1.Value = dateEnd.ToUniversalTime().ToString("yyyy-MM-ddT00:00:00Z");
    dateConstant1.Item = dateConstantValue1;
    lessThanOrEqualTo.FieldURIOrConstant = dateConstant1;
    RestrictionType restriction = new RestrictionType();
    AndType andType = new AndType();
    andType.Items = new SearchExpressionType[] { lessThanOrEqualTo , isGreaterThanOrEqual };
    restriction.Item = andType;
    findItemRequest.Restriction = restriction;
    How can I modify this to give me emails older than a specific date?  Also any input on doing the deleting would also be greatly appreciated!
    Best Regards,
    Nelson

    Thank you very much Glen!  I can't believe it was that easy.  Works perfect.  I will work on the DeleteItemType.  I was also wondering if there was a way to detect if an email is an Out-of-Office (OOO) or Undeliverable message? 
    My app goes through all the emails and I need to skip any that are OOO or Undeliverable messages.  I've learned how to use the SearchFilter and I find that easier and more straight forward than setting the restrictions.  I'm also able to use a SearchFilter
    to get emails older than the specified date. 
    Here's my new code for reading unread emails using the SearchFilter and paging (for better efficiency). 
    1 - Is there anyway to tell the filter to get AllProperties without having to specify each one using ItemSchema or EmailMessageSchema?
    2- What is the difference between those two (any advantages over one or the other)?
    3 -Is there any reason to even be using the ExchangeServiceBinding here anymore since it seems the ExchangeService object is all I need?  In my old code, I was using the ExchangeService object to do an AutoDiscover and then using that to set the URL
    in the ExchangeServiceBinding.  What are the main to difference/uses for these to objects?  Sorry if that's a dumb question.
    private void GetUnReadEmails(string sMailboxName)
    // Create the binding to Exchange
    ExchangeServiceBinding esb = new ExchangeServiceBinding();
    esb.RequestServerVersionValue = new RequestServerVersion();
    //Console.WriteLine("Exchange version: " + esb.RequestServerVersionValue.Version);
    //esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1;
    ExchangeService service = GetBinding(sMailboxName);
    Console.WriteLine("Exchange version: " + service.RequestedServerVersion);
    esb.Url = service.Url.ToString();
    esb.Credentials = new NetworkCredential(Username, Password, Domain);
    Mailbox mb = new Mailbox(sMailboxName);
    FolderId fid1 = new FolderId(WellKnownFolderName.Inbox, mb); // where fid1 was WellKnownFolderName.Inbox
    //FindFoldersResults findResults = service.FindFolders(fid1, new FolderView(int.MaxValue));
    ItemView iv = new ItemView(50, 0);
    FindItemsResults<Item> findResults = null;
    PropertySet ivPropSet = new PropertySet(BasePropertySet.IdOnly);
    //SearchFilter ivSearchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false), new SearchFilter.ContainsSubString(ItemSchema.Subject,"MSGID:"));
    SearchFilter searchFilter = new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false);
    iv.PropertySet = ivPropSet;
    do
    findResults = service.FindItems(fid1, searchFilter, iv);
    string sText = "";
    if(findResults.Items.Count > 0)
    //PropertySet itItemPropSet = new PropertySet(BasePropertySet.IdOnly) { EmailMessageSchema.Body };
    PropertySet itemPropSet = new PropertySet(BasePropertySet.IdOnly) {ItemSchema.Subject, ItemSchema.Body, ItemSchema.DateTimeReceived, ItemSchema.HasAttachments, ItemSchema.ItemClass};
    itemPropSet.RequestedBodyType = BodyType.Text;
    service.LoadPropertiesForItems(findResults.Items, itemPropSet);
    //service.LoadPropertiesForItems(findResults.Items, itItemPropSet);
    //service.LoadPropertiesForItems(findResults, new PropertySet(ItemSchema.Subject, ItemSchema.Body, ItemSchema.DateTimeReceived));
    Console.WriteLine("Total items: " + findResults.TotalCount);
    foreach (Item item in findResults.Items)
    Console.WriteLine("ItemID: " + item.Id.UniqueId);
    Console.WriteLine("Subject: " + item.Subject);
    Console.WriteLine("Received date: " + item.DateTimeReceived);
    Console.WriteLine("Body: " + item.Body);
    Console.WriteLine("Has attachments: " + item.HasAttachments);
    //Mark the email as read
    EmailMessage emEmail = EmailMessage.Bind(service, item.Id);
    //emEmail.Load();
    emEmail.IsRead = true;
    emEmail.Update(ConflictResolutionMode.AlwaysOverwrite);
    sText += "Subject: " + (item.Subject.Trim()) + " ";
    //sText += "DisplayTo: " + (item.DisplayTo.Trim()) + " ";
    sText += "DateTimeReceived: " + (item.DateTimeReceived.ToString()) + " ";
    sText += "ItemClass: " + (item.ItemClass.Trim()) + " ";
    sText += "\r\n";
    else
    sText = "No unread emails";
    Console.WriteLine("No unread emails");
    txtItems.Text = sText;
    iv.Offset += findResults.Items.Count;
    } while (findResults.MoreAvailable == true);
    Thanks again for your time.  I appreciate it.
    Nelson

  • I need to able to search for calendar entries that are over one year old.

    I am an old Palm OS user and have used the calendar on it to track my clients visits/service for the last 15 years.  By searching the customers name on the palm, it would bring up every entry I had keyed in for them, so I could immediately know how old their equipment was, what service had been done, etc.  I also used the calendar to track my daily and weekly sales.  I was disappointed to find that the ipad does not search for any entries older than one year.  Is there something that can fix this or is there an app that could be used in the way the palm was?  Thanks

    Well, that would depend on what calendar you are using.
    If you are simply relying on the calendar on the device, well, that's not very smart.  Restoring from backup should put everything back.
    If the calendar is synced with another service, like Google, iCloud, Exchange, do the entires still exist there?
    If the calendar is synced with Outlook or iCal on your computer, do the entries still exist there?

  • Calendar search not finding calendar events older than a year.

    Calendar search cannot find events older than a year.
    neither does spotlight search.
    iphone 4s 16GB ios version 7.1.2
    ipad 32GB with retina (purchased on 2012) ios version 7.1.2
    Does anybody has the same issue?
    Calendar events over one year old are not found when searched on iOS. Neither on the iPhone nor the iPad. Although they are found on a mac running mavericks calendar app.
    All events are displayed when going directly to the month and viewing all the events of each day, but she search feature, the one accessed through the little magnifier, simply cannot find any event older than a year.
    I have multiple events in my calendar and I tested them and the last I can find is within 365 days of today. after that events cannot be found.
    steps to reproduce:
    1. go into the calendar app on the iPhone and add an event but use a date date 13 months older than the current date. Save the event.
    2. verify the even is created by looking at the day of the event
    3. on the top right corner of the calendar app select the magnifying glass and try to search the event by typing any word you used on the title of the event just created
    4. search result will display No Results
    5. exit the calendar and access spotlight search on the home screen by using the "pull down" gesture from an area outside of the dock, including the top row of app icons. Type any word you used on the title of the event just created
    6. search result will not display the event
    Thanks

    this has already been answered.
    please ignore my question.

  • IPhone calendar faile to search for future events more than 1 year

    Dear guys,
    I can't search for future events more than 1 year later.
    Is it a common scenario?
    Many thanks!

    Dear guys,
    I can't search for future events more than 1 year later.
    Is it a common scenario?
    Many thanks!

  • Using the USB cable to sync my blackberry deletes all calendar entries older than 3 mos

    I'm not very good at this kind of thing, so please pardon what I'm sure will be mistakes/omissions as I describe my problem.
    Every time I sync my blackberry using the USB cable (I'm told by my boyfriend who is an IT guy that I can't sync it wirelessly although I don't know why), all of my calendar entries in Outlook get erased--that is, all the entries that are older than 3 mos.  I frequently use those entries as reference so I can't lose them--so now I'm terrified to sync my blackberry.
    Any help will be much appreciated!
    Jenny

    I just found this on the support page and am going to try it for a couple of days to see if it solves the problem:
    Document ID:
    KB18694
    Modified Date:
    01-18-2010
    Document Type:
    Support
    Print this page
    Contents [show]
       Products
       Environment
       Overview
       Cause
       Resolution
    Products
    BlackBerry® Desktop Software
    BlackBerry® Desktop Software Version 1.0 (Mac OS)
    BlackBerry® Devices
    Environment
    BlackBerry® Desktop Manager
    BlackBerry® Desktop Manager Version 1.0 (Mac OS)
    BlackBerry smartphone
    Microsoft® Outlook®
    Yahoo!® Mail calendar
    Apple iSync
    Overview
    When synchronizing the Calendar via the BlackBerry Desktop Manager, past calendar events are being deleted on the desktop calendar application.
    Cause
    Calendar items on the BlackBerry smartphone were deleted as a result of the keep appointments setting in the Calendar was set to delete older appointments.
    Resolution
    To resolve this issue, complete the following steps:
    Task 1
    Configure the BlackBerry smartphone to keep past appointments:
    Open the Calendar application on the BlackBerry smartphone and press the Menu key.
    Select Options and then General Options.
    Within General Options set the Keep Appointments options to Forever.
    Task 2
    Configure BlackBerry Desktop Manager calendar synchronization options:
    For BlackBerry Desktop Manager version 4.5 to 5.0:
    Connect the BlackBerry smartphone to the computer with a USB cable and open BlackBerry Desktop Manager.
    Select Synchronize from the main menu of BlackBerry Desktop Manager.
    Select the Synchronization link and click on the button labeled Synchronization to configure the synchronization settings on the BlackBerry smartphone.
    Select the Calendar.
    Select the option to Synchronize with Microsoft Outlook and click Next.
    Select either the Two way or One way sync and click Next.
    Select the Default profile for Microsoft Outlook.
    For the Calendar date range select the option to Synchronize items within a range of days, configure the date range to sync 30 days in the past and 365 days in the future.
    Click Next.
    Continue through the configuration wizard and click Finish and then OK.
    Perform a new synchronization.
    For BlackBerry Desktop Manager version 4.2 and 4.3:
    Connect the BlackBerry smartphone to the computer with a USB cable and open BlackBerry Desktop Manager.
    Select Synchronize from the main menu of BlackBerry Desktop Manager.
    Click on the Configuration tab and then on Configure Sync.
    Select the Calendar.
    Select the option to Synchronize with Microsoft Outlook and click Next.
    Select either the Two way or One way sync and click Next.
    Select the Default profile for Microsoft Outlook.
    For the Calendar date range select the option to Synchronize items within a range of days, configure the date range to sync 30 days in the past and 365 days in the future.
    Click Next.
    Continue through the configuration wizard and click Finish and then OK.
    Perform a new synchronization.
    If you are still prompted to make deletions from Microsoft Outlook for past calendar events that were not manually deleted, then you may need to repeat the steps above and synchronize with a smaller date range for past events.
    For BlackBerry Desktop Manager version 1.0 for Mac OS:
    Connect the BlackBerry smartphone to the Mac with a USB cable and open BlackBerry Desktop Manager.
    Select Calendar.
    Select Two-Way.
    Select All Calendars or Selected Calendar, checkmark calendars to use during synchronization.
    Select Advanced Settings.
    For the Calendar date range select the option to Only events, configure the date range to sync 30 days prior and 365 days after.
    Click on Sync.
    Top of page
    Disclaimer
    By downloading, accessing or otherwise using the Knowledge Base documents you agree:
       (a) that the terms of use for the documents found at http://www.blackberry.com/support/knowledgebase/disclaimer.shtml apply to your use or reference to these documents; and
       (b) not to copy, distribute, disclose or reproduce, in full or in part any of the documents without the express written consent of RIM.
    Visit the BlackBerry Technical Solution Center at http://www.blackberry.com/btsc.

  • Why spotlight is not able to perform searches on iCal events older than 365 days?

    why spotlight is not able to perform searches on iCal events older than 365 days? I really do not understand why if iCal can sync all events, even the very old, the spotlight will not be able to search on events older than 365 days; why? is absurd; let's say I want to search for a person contained in an old appointment: iCal in your Mac with a few key words, I find it right away, but this important feature on the iPhone is locked; we have in our pockets phones are very sophisticated, but it does not manage to make things really trivial.

    Submit your feedback directly to Apple using the appropriate link on the Feedback page:
    http://www.apple.com/feedback

  • IPhone will not display calendar items more than one day in advance.

    iPhone will not display calendar items more than one day in advance. 
    I used to have a droid and loved the calendar on the main screen that used to show me the next few appointments coming up - so far I have only figured out how to put in to show for next day or 2 days or etc....
    is there any way to show tomorrow and next few days in notification, or is there a good app out there that will greet me. dont have 4s to ask just a 4
    i used google calendar and they all show up in calendar but REALLY need the functionality to see what is coming up, kind of like what you see in outlook or any other email program.
    please help out this noob.

    Is this what you're doing:
    OS X Yosemite: Recover your entire system

  • TS2481 All of my calendar history older than 30 days has disappeared from my iphone5.  I have not synced it with my computer.  It just suddenly disappeared.  Is there any way to get it back?

    All of my calendar history older than 30 days has disappeared from my iphone 4S.  I did not perform a sync with my computer-it literally just disappeared!  Is there any way to get it back?

    Unfortunatly for me I did not, do you think there might be any other way? Maybe by accesing it directly through direct USB contact and not through iTunes?

  • Search for a phrase rather than a single word in speech analysis text?

    Is it possible to search for a phrase rather than a single word in speech analysis text?

    Did you try Apache POI?
    It's here:
    http://jakarta.apache.org/poi/

  • Saving a swf-file for flash player older than 10.3 in Flash CC

    Hi,
    I am working with Flash CC and need to save my swf-files for Flash Player older than 10.3.
    Is there any chance to do so?
    Besides working with CS6 again ;-)
    Thanks for every help!

    In the meantime I found a very good answer myself.
    For anyone who might need it, too:
    Re: Can Flash Pro CC publish to flash player 9??

  • Search for iTunes items by price

    Is it possible o search for iTunes items such as movies &amp; music by price? For example all the movies that are $6.99 or any other price by that matter, not just the few that iTunes has listed in their movies home page.

    The "big offer" IS what you are missing. The movies that are normally 9.99 being reduced to 4.99 for a limited time but unable to find them is counter productive on Apple's part. If you are going to put movies on sale, you need to have a way for people to find out what those movies are!
    It's like a store having a Black Friday Sale flyer with random products that are not on sale, but the store would like you to buy them. You can go to the store to find the Black Friday deals but you have to look at every product on every self in every isle to see if they have a sale sticker on them.
    That's how hard it is to find movies that are $4.99 on the iTunes Store now. I used to purchase 5-10 movies a month when the Limited Time $4.99 Movies was something you could just click and see. Now I buy maybe 2-3 movies because I hate clicking on every genre and then every movie in the genre to check the SD price because it only shows the HD and Rental prices in the genre lists.

  • API to search for PIM items

    Is there any API to search for an item in PIM. I have a requirement to search for item by Inventory Org, routing class, operation class and resource.
    thank
    satya

    Satya,
    I am not sure or aware of any API. This should be falling under the catalog functionality.
    But the functionality does exist in the front end in the PIM application (resp Product Information Management Data Librarian) there is a functionality of item search (you know that probably). You can explore the OAF pages and related VOs or implementations of that page.
    Thanks
    Nagamohan

  • Blackberry Complaint / Feature Request - Please add category support for calendar Items already

    RIM: It's December 2010, and thousands of people have repeatedly asked for category support for calendar items for years now. In BB OS 5 & 6 we can assign categories to Contacts and Task items, but still not Calendar items? This makes no sense to me.
    Many people rely on categories to keep their calendar items organized, and I'm baffled as to why such a simple feature request has continued to be ignored. Obviously BlackBerry's DO support Outlook/Exchange category syncing, since I can see all of my custom categories through the Task and Contact apps. When I add a new category for a contact, it gets synced between Outlook/Exchange and my Blackberry. The support is there. But for a professional/business smartphone OS, I'm taken back as to how this feature could be missing from the calendar in the first place.
    Rim, please give us a response--a glimmer of hope--something to let us know that you are listening to us and plan on incorporating a category feature into the calendar! If the Blackberry OS didn't support categories at all, that would be a different matter and I would understand that maybe bit more development would be necessary to support this. But the capability is obviously already built in!!! 
    PLEASE listen to your customers RIM and give us this commonly requested feature as soon as possible!!!

    You're welcome.
    I'd also suggest you call your carrier blackBerry tech support and make the point there, asking them to give it consideration on the next OS upgrade. RIM does listen to their partners.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Update Date is older than the Creation Date

    Hi Team,
    In the Oracle Application 11i forms we are seeing the Update Date is older than the Creation Date?
    But the creation date should be older then the updated date.
    Thanks,

    What 11i release are you on?
    Can you please elaborate more on the Creation/Update dates mentioned above? Are you referring to forms or tables or specific rows? Is this happening to all data/forms? Please provide an example for us to understand your issue.
    Thanks,
    Hussein

Maybe you are looking for

  • Import package failed

    hi When compiled with java 1.5, I get the message package a.b.c does not exist. Into what directory do you need to store a executalbe jar file in order to be able to import the package?

  • JavaMail - Send Attachements

    Can anyone please check the following code for me. I'm trying to send attachments but I did not get anything. The attachments I'm getting is from a jsp file by using <input type="file" name="photo1..3">. When I hit the submit button, it just show a b

  • Strange behaviour of polling adapter

    Hi All, I have a strange situation where the database polling is not happening. Here is my use case I have a polling db adapter which picks up a record from the table and invokes a procedure on the same database instance with the same connection fact

  • T.CODE 'F110'

    Hi, I want to know if i can make partial payment on transaction 'F110' Thanks.

  • Getting photos back off iPod onto computer

    My hard drive in my G5 went bad but the good news is all my photos (2800+) are backed up on my iPod. My fear is that when I connect the ipod to another computer, the iPod will be erased and I will loose everything. What is the best way to do this?