none
querying mails from outlook inbox folder RRS feed

  • Question

  • Hi,

    i have to query mails from inbox based on the userproperty we had set while sending the context mails.

    Redemption.

    RDOFolder RDOFldr = RDOObj.GetDefaultFolder(Redemption.rdoDefaultFolders.olFolderInbox);

    RDOItms = RDOFldr.Items;
     
    string strFilter = "SELECT \"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ORCHCTX\" FROM FOLDER WHERE \"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ORCHCTX\" <> NULL";

    Redemption.RDOMail RDM= RDOItms.Find(strFilter);


    this the way am doing it, but RDM is null even after executing the query and context mails are there in my inbox. how to do this? any suggestions?

    also each time i should query only ten mails from the bottom to check whether any mails are which are older than 3 months, later when qurying for the second time i should leave the previous ten mails and i should get next ten mails. how to do this? any help would be appreciated.

     

    thanks in advance

    shilpa

    Friday, November 11, 2011 5:57 AM

Answers

  • Are you sure that the emails actually have that property added and that your schema for it is correct?
     
    To work on 10 items at a time you'd obviously need to set a counter to exit a loop after 10 iterations. You would need to mark the items somehow so they aren't processed again, if you don't need to preserve that added property you can just set it to null and remove it on the processed items. If you need to preserve the property you can add an additional property to indicate the item was processed, then include a test for the property not existing in your filter.
     
    You can sort the RDOItems collection in descending order on any date field, such as CreationTime, before you do your filtered search. That should return the oldest items first that meet your filter criteria.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Shilpakrishna" <=?utf-8?B?U2hpbHBha3Jpc2huYQ==?=> wrote in message news:11366775-4f8c-4714-b959-da31d7e0b15e...

    Hi,

    i have to query mails from inbox based on the userproperty we had set while sending the context mails.

    Redemption.

    RDOFolder RDOFldr = RDOObj.GetDefaultFolder(Redemption.rdoDefaultFolders.olFolderInbox);

    RDOItms = RDOFldr.Items;
     
    string strFilter = "SELECT \"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ORCHCTX\" FROM FOLDER WHERE \"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ORCHCTX\" <> NULL";

    Redemption.RDOMail RDM= RDOItms.Find(strFilter);


    this the way am doing it, but RDM is null even after executing the query and context mails are there in my inbox. how to do this? any suggestions?

    also each time i should query only ten mails from the bottom to check whether any mails are which are older than 3 months, later when qurying for the second time i should leave the previous ten mails and i should get next ten mails. how to do this? any help would be appreciated.

     

    thanks in advance

    shilpa


    Ken Slovak MVP - Outlook
    Friday, November 11, 2011 3:07 PM
  • Also use "IS NOT NULL" instaed of "<> NULL".
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Sunday, November 13, 2011 1:19 AM

All replies

  • Are you sure that the emails actually have that property added and that your schema for it is correct?
     
    To work on 10 items at a time you'd obviously need to set a counter to exit a loop after 10 iterations. You would need to mark the items somehow so they aren't processed again, if you don't need to preserve that added property you can just set it to null and remove it on the processed items. If you need to preserve the property you can add an additional property to indicate the item was processed, then include a test for the property not existing in your filter.
     
    You can sort the RDOItems collection in descending order on any date field, such as CreationTime, before you do your filtered search. That should return the oldest items first that meet your filter criteria.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Shilpakrishna" <=?utf-8?B?U2hpbHBha3Jpc2huYQ==?=> wrote in message news:11366775-4f8c-4714-b959-da31d7e0b15e...

    Hi,

    i have to query mails from inbox based on the userproperty we had set while sending the context mails.

    Redemption.

    RDOFolder RDOFldr = RDOObj.GetDefaultFolder(Redemption.rdoDefaultFolders.olFolderInbox);

    RDOItms = RDOFldr.Items;
     
    string strFilter = "SELECT \"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ORCHCTX\" FROM FOLDER WHERE \"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ORCHCTX\" <> NULL";

    Redemption.RDOMail RDM= RDOItms.Find(strFilter);


    this the way am doing it, but RDM is null even after executing the query and context mails are there in my inbox. how to do this? any suggestions?

    also each time i should query only ten mails from the bottom to check whether any mails are which are older than 3 months, later when qurying for the second time i should leave the previous ten mails and i should get next ten mails. how to do this? any help would be appreciated.

     

    thanks in advance

    shilpa


    Ken Slovak MVP - Outlook
    Friday, November 11, 2011 3:07 PM
  • Also use "IS NOT NULL" instaed of "<> NULL".
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Sunday, November 13, 2011 1:19 AM