Excluding public folders when enumerating Outlook folders

I have an Outlook plugin that searches all Outlook folders for certain information.
However, some users have been complaining that the plugin searches public folders as well, which are huge in certain corporations, and that in turn makes the search very slow.
I now use the following mechanism to search Outlook folders:
NameSpace nameSpace = outlookApp.GetNamespace("MAPI");
Folders accountFolders = nameSpace.Folders;
try
if (nameSpace == null || accountFolders == null)
return null;
for (int i = 1; i <= accountFolders.Count; i++)
MAPIFolder accountFolder = accountFolders.Item(i);
MailItem res = null;
try
res = ScanFolder(accountFolder, mailId, scanUI);
finally
if (accountFolder != null) Marshal.ReleaseComObject(accountFolder);
if (res != null) return res;
return null;
finally
if (accountFolders != null) Marshal.ReleaseComObject(accountFolders);
if (nameSpace != null) Marshal.ReleaseComObject(nameSpace);
I've tried to look at the MAPIFolder object, but I didn't find any flag that could help me distinguish standard folders from public folders. Is there a way to do that?
Thanks,
Jan

Read the PR_MDB_PROVIDER property (DASL name http://schemas.microsoft.com/mapi/proptag/0x34140102) using MAPIFolder.PropertyAccessor.GetProperty, convert it to hex using MAPIFolder.PropertyAccessor.BinaryToString. For the PF store objects,
PR_MDB_PROVIDER property will be pbExchangeProviderPublicGuid (78B2FA70AFF711CD9BC800AA002FC45A) - you can see that property (and others) in
OutlookSpy: click IMAPIFolder button.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.5 is now available!

Similar Messages

  • Problem with DFS when enumerating large folders

    Hi,
    In our organization we have DFS in place. We don't use DFS-r replication. The DFS roots are hosted on 3 2012R2 domain controllers and we have 2 domain based namespaces (windows 2000 mode). We have a lot of issues when users/applications/servers are trying
    to open folders with lots of files in them (typically 10000+). When this happens DFS hangs organization wide. This causes a lot of problems for back-end applications which are constantly moving around files to different front-end systems. Most of them
    get exceptions resulting in a manual restart. Since our organization is running 24/24, 7/7, this is very ennoying. Especially for engineers who have to get up at night to restart those services.
    All user folders/mapped network disks are using DFS to access the file server. We have more then 2000 employees accessing a DFS namespace. At the time the issue occurs, they also experience problems accessing their data. 
    When the issues occur, we have no problems accessing the targets themselves, so we can exclude file server issues. We use a third party appliance as DNS server, but this also works as should at the time the issue occurs. The only way to resolve our issue
    that we have found so far is to clean out those folders, or when that's not possible, exlude them from the DFS namespace.
    We thought upgrading our DC's from 2003 to 2012R2 would resolve the issue but that didn't do it. Is this a known issue and is there another workaround/fix? Also, is there a way to find out which target caused
    DFS to hang? We have already done a lot of troubleshooting with articles we found on the net but nothing seems to be wrong with our DFS setup/AD/DNS. We also opened serveral cases with MSFT but after the network trace analysis they always conclude there's
    nothing wrong.
    Thanks in advance! 

    Hi,
    Distributed File System (DFS) currently has a size recommendation of 5000 folders with a target in a domain-based namespace. It belongs to Windows Server 2000 DFSN and not to Windows Server 2008. You could create a domain namespace in “Windows Server 2008 mode”
    to create more than 5000 folder. 
    When the number of links exceeds the recommended limit, you might experience performance degradation when making changes to the DFS configuration.
    To reduce this problem, you could add more DFS Namespace server to spread the request to more servers. 
    For more detailed information, please refer to the article below:
    Reviewing DFS Size Recommendations
    http://technet.microsoft.com/en-us/library/cc776068(v=ws.10).aspx
    DFSN PERFORMANCE, WHERE ARE YOU?
    http://marco-difeo.de/2014/01/16/dfsn-performance-where-are-you/
    Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Best Regards,
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Ignoring "Public Folders" when listing folders on an Exchange account?

    hi-
    i downloaded javamail 1.4.2 and ran the demo example "folderlist" against an exchange account i have using the "imap" protocol.
    it listed all my folders correctly, including "Public Folders" and its subfolders.
    i'd like to not list "Public Folders" though, and so was wondering if there is a programmatic way of ignoring this folder and any
    other public folders.
    when i run "folderlist" in verbose mode, i get for the "Public Folders":
    Name: Public Folders
    Full Name: Public Folders
    URL: imap://exchange-user@exchange-host/Public Folders
    Not Subscribed
    Is Directory
    IMAP Attributes:
    \Noselect
    is it appropriate to intrepret "\Noselect" as folders i don't want to include in my folder list?

    Use the Store.get*Namespaces methods. You probably only want to list the personal namespaces.

  • Why cant I send emails, or open folders, from my Outlook email when using ipad. My Outlook is functioning normally when accessed from laptop.

    Why am I unable to send emails or open folders from my Outlook email when using my iPad?  My Outlook is functioning normally when accessed from my laptop.  This problem has been going on for three days now - everything was functioning normally before. I have looked at the standard troubleshooting suggestions provided by Apple, but they do not appear to cover this eventuality.  I should be most grateful for any help.

    Try first to Clear your cache from : Tools > Options > Advanced > Network, Clear Now button.
    if the above is not helpful, [https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles create a new profile] and check it again.
    if you create the new profile see: [https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles#w_recovering-information-from-an-old-profile Recovering information from an old profile]
    thank you

  • Can't get PC Suite to sync with Outlook folders

    When I try to set up PC Suite to sync with my Outlook contacts (in Personal Folders) by pressing "Select Folders" the application hangs - every time. I was using a 6230 - and now want to get my phone contacts onto a 6230i. Running XP SP2 and PC Suite 6.8.21 Tried it with Outlook running and not running. Only seems to work if you sync with the main Outlook contacts folder. Have worked around the issue by moving all my contacts to a temp folder, syncing the phone with the main folder, and then moving the contacts around, but it's not very elegant... Any ideas? Stephen

    I found out, that the problem what we have is our Public Folder Structure in the company. We have more as 40'000 public folders in this structure.
    Now i find out that when i start my Outlook in a offline modus i can selct my special folder after i press the "Select Folder" button.
    When i try the same thing in online modus the PC-Suite hangs...
    The only combinations that i see is the Public Folder.
    I try a test in the evening: I push the button "Select Folder" and have run my PC over the Night. On the next morning the Window was appear.
    Also was is my problem the Public Folder Structure that the PC-Suite scans after i push the button "select Folder"

  • Cannot open your default e-mail folders. You must connect to Microsoft Exchange with the current profile before you can synchronize your folders with your Outlook data file (.ost)

    Fresh installation of Exchange Server 2013 on Windows Server 2012.
    Our first test account cannot access their email via Outlook but can access fine through OWA. The following message appears - "Cannot open your default e-mail folders. You must connect to Microsoft Exchange with the current profile before you can synchronize
    your folders with your Outlook data file (.ost)" is displayed.
    If I turn off cached Exchange mode, setting the email account to not
    cache does not resolve the issue and i get a new error message - "Cannot open your default e-mail folders. The file (path\profile name).ost is not an Outlook data file (.ost). Very odd since it creates its own .ost file when you run it for the first
    time.
    I cleared the appdata local Outlook folder and I tested on a new laptop that has never connected to Outlook, same error message on any system.
    Microsoft Exchange RPC Client Access service is running.
    No warning, error or critical messages in the eventlog, it's like the healthiest server alive.
    Any help would be greatly appreciated. I haven't encountered this issue with previous versions of Exchange.

    So it looks like a lot of people are having this issue and seeing how Exchange 2013 is still new (relatively to the world) there isn't much data around to answer this. I've spend ALOT of time trying to figure this out.
    Here is the answer. :) - No I don't know all but I'm going to try to give you the most reasonable answer to this issue, in a most logical way.
    First thing I did when I was troubleshooting this issue is that I ignored Martina Miskovic's suggestion for Step4 http://technet.microsoft.com/library/jj218640(EXCHG.150)because it didn't make sense to me because I was trying to connect
    Outlook not outside the LAN but actually inside. However, Martina's suggestion does fix the issue if it's applied in the correct context.
    This is where the plot thickens (it's stew). She failed to mention that things like SSL (which I configure practically useless - anyone who ever worked in a business environment where the owner pretty much trusts anyone in the company, otherwise they don't
    work there - very good business practice in my eyes btw, can confirm that...) are some sort of fetish with Microsoft lately. Exchange 2013 was no exception.
    In exchange 2003, exchange 2007 and exchange 2010 - you could install it and then go to outlook and set it up. And when outlook manual Microsoft Exchange profile would ask you for server name, you would give it and give the name of the person who you setting
    up - as long as machine is on the domain, not much more is needed. IT JUST WORKS! :) What a concept, if the person already on premises of the business - GIVE HIM ACCESS. I guess that was too logical for Microsoft. Now if you're off premises you can use things
    like OutlookAnywhere - which I might add had their place under that scenario.
    In Exchange 2013, the world changed. Ofcourse Microsoft doesn't feel like telling it in a plain english to people - I'm sure there is an article somewhere but I didn't find it. Exchange 2013 does not support direct configuration of Outlook like all of it's
    previous versions. Did you jaw drop? Mine did when I realized it. So now when you are asked for your server name in manual outlook set up and you give it Exchange2013.yourdomain.local - it says cannot connect to it. This happens because ALL - INTERNAL AND
    EXTERNAL connection are now handled via OutlookAnywhere. You can't even disable that feature and have it function the reasonable way.
    So now the question still remains - how do you configure outlook. Well under server properties there is this nice section called Outlook anywhere. You have a chance to configure it's External and Internal address. This is another thing that should be logical
    but it didn't work that way for me. When I configured the external address different from the internal - it didn't work. So I strongly suggest you get it working with the same internal address first and then ponder how you want to make it work for the outside
    users.
    Now that you have this set up you have to go to virtual directories and configure the external and internal address there - this is actually what the Step 4 that Martina was refering to has you do.
    Both external and internal address are now the same and you think you can configure your outlook manually - think again. One of the most lovely features of Outlook Anywhere, and the reason why I had never used it in the past is that it requires a TRUSTED
    certificate.
    See so it's not that exchange 2013 requires a trusted certificate - it's that exchange 2013 lacks the feature that was there since Windows 2000 and Exchange 5.5.
    So it's time for you to install an Active Direction Certificate Authority. Refer to this wonderful article for exact steps - http://careexchange.in/how-to-install-certificate-authority-on-windows-server-2012/
    Now even after you do that - it won't work because you have to add the base private key certificate, which you can download now from your internal certsrv site, to Default Domain Policy (AND yes some people claim NEVER mess with the Default Domain Policy,
    always make an addition one... it's up to you - I don't see direct harm if you know what you want to accomplish) see this: http://technet.microsoft.com/en-us/library/cc738131%28v=ws.10%29.aspx if you want to know exact steps.
    This is the moment of ZEN! :) Do you feel the excitement? After all it is your first time. Before we get too excited lets first request and then install the certificate to actual Exchange via the gui and assign it to all the services you can (IIS, SMTP and
    there is a 3rd - I forgot, but you get the idea).
    Now go to your client machine where you have the outlook open, browse to your exchange server via https://exchang2013/ in IE and if you don't get any certificate errors - it's good. If you do run on hte client and the server: gpupdate /force This will refresh
    the policy. Don't try to manually install the certificate from Exchange's website on the client. If you wanna do something manually to it to the base certificate from the private key but if you added it to the domain policy you shouldn't have to do it.
    Basically the idea is to make sure you have CA and that CA allows you to browse to exchange and you get no cert error and you can look at the cert and see that's from a domain CA.
    NOW, you can configure your outlook. EASY grasshoppa - not the manual way. WHY? Cause the automatic way will now work. :) Let it discover that exachange and populate it all - and tell you I'm happy! :)
    Open Outlook - BOOM! It works... Was it as good for you as it was for me?
    You may ask, why can't I just configure it by manual - you CAN. It's just a nightmare. Go ahead and open the settings of the account that got auto configed... How do you like that server name? It should read something like [email protected]
    and if you go to advanced and then connection tab - you'll see Outlook Anywhere is checked as well. Look at the settings - there is the name of the server, FQDN I might add. It's there in 2 places and one has that Mtdd-something:Exchange2013.yourdomain.local.
    So what is that GUID in the server name and where does it come from. It's the identity of the user's mailbox so for every user that setting will be different but you can figure it out via the console on the Exchange server itself - if you wish.
    Also a note, if your SSL certs have any trouble - it will just act like outlook can't connect to the exchange server even though it just declines the connection cause the cert/cert authority is not trusted.
    So in short Outlook Anywhere is EVERYWHERE! And it has barely any gui or config and you just supposed to magically know that kind of generic error messages mean what... Server names are now GUIDs of the [email protected] - THAT MAKES PERFECT
    SENSE MICROSOFT! ...and you have to manage certs... and the only place where you gonna find the name of the server is inside the d*** Outlook Anywhere settings in the config tab, un it's own config button - CAN WE PUT THE CONFIG ANY FURTHER!
    Frustrating beyond reason - that should be Exchange's new slogan...
    Hope this will help people in the future and won't get delete because it's bad PR for Microsoft.
    PS
    ALSO if you want to pick a fight with me about how SSL is more secure... I don't wanna hear it - go somewhere else...

  • I am using a microsoft exchange email account and folders from my outlook account are not showing up in my inbox?, I am using a microsoft exchange email account and folders from my outlook account are not showing up in my inbox?

    I just imported my microsoft outlook inbox to my iphone and when I look in the email acount emails that have been set to filter to folders in my outlook account to named folders via a rule do not appear in my iphone, even though I have selected those folders to push in the exchange settings.  Any ideas?

    Your messages shouldn't be lost, you can check via webmail if they do exist on the server.
    Verify you do have the Google recommended settings.
    https://support.google.com/mail/answer/78892?hl=en
    Verify you subscribed to all the folders you want to see.
    File (Alt-F) - Subscribe

  • Except Outlook folders' system, all other suddenly disappear after a custom backup

    As I don't trust Microsoft, a have prepared a daily backup for the PST files onto a different location on the local drive as well as to a network drive in the office. The backup is a BAT file with xcopy command. The BAT instructs Outlook to close through
    taskkill command before starting copy.
    As soon as the backup finishes, Outlook is opened (through 'start Outlook.exe'). The backup system works fine. However,
    SOMETIMES, when the Outlook opens, all the folders, except those of the system (Inbox, outbox, etc) , simply disappear!! At this very moment, my colleagues in the office fear having lost all the e-mails. I just ask them to close and re-open
    Outlook then the folders come back uneventfully.
    Can someone from Microsoft explain why the folders disappear? It is quite strange because it does not happen in certain computers (we have fifteen in the network), but randomly.
    If it help, we use POP3 and all computers retrieve e-mails from at least ten different email accounts being all of them filed in one only PST file.
    We used to use Windows Mail on Windows 7 (of course through a tweaking) and now we migrated all e-mails to Outlook as it appears to be more professional for many reasons. But, once more, I'm fearing that it may be not so good.
    Rogerio Martins

    Hi,
    Since it doesn't really cause the emails/folders to lose, and not all computers have this problem, I may assume if it's 3rd-part add-ins caused the folders not display at the first start.
    Have the users start Outlook in Safe Mode, if the issue will never reappear in Safe Mode, disable the suspicious add-ins to verify my assumption.
    Start Outlook in Safe Mode:
    Press Win + R and type “outlook.exe /safe” in the blank box, then press Enter.
    To disable add-ins:
    1. File -> section Options -> section Add-Ins
    2. At the “Manage” dropdown list at the bottom select which type of add-ins you would like to enable/disable
    3. Press “Go…” and make the changes
    4. For some add-ins you’ll need to restart Outlook for changes to take effect.
    Regards,
    Melon Chen
    TechNet Community Support

  • Outlook folders on email

    I have different inbox folders on my outlook email synced from my computer to my new GSIII, I only get notifications on the main email inbox, and none of the folders within the inbox.  Am i doing something wrong or is this just how it works...I just came from a blackberry and all folders regardless would show a notification...Any answers would help out...The new emails are there, you just have to search thru each folder and see if anything is new or not.  I have 20 different folders within my inbox from Outlook.

    I'm not exactly sure what you are referring to.  I have three email accounts and all enter into one inbox on my outlook.  I have also set up all three accounts on my GSIII and have no problems with notifications. When you are speaking of folders are you referring to different email accounts or sub folders for the same email account?  If they are separate email accounts then have you tried going to "settings" from the inbox screen?   Once there you can select the individual email accounts and change their settings including the notification sound.  I have three email accounts and each one has a separate notification sound.  I then use the "combined view" inbox to view all emails.  If I want to reply from a specific email account I change to it's inbox view.  New emails are bold and read emails are shaded.  Hope this helps!

  • Outlook folders not synchronsing to curve

    Hi, my second post of the day...
    Is it possible to synchronise my outlook folders with my curve 9300. Outlook/e-mail account is a office 365 and it has been setup on the phone as a Internet mail account. We no longer have a BES.
    Thanks

    Hello,
    Sorry, but OTA, folder sync is only available for BES-level legacy BB devices, not personal-level email accounts. Refer:
    Article ID: KB28745 Unable to receive email messages on the integrated account when the messages are being forwarded to another sub folder in the email client
    With the newer BB10 devices, server-based folders are fully available for all accounts.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How do I sync all my email folders in Microsoft Outlook to my ipad

    I have setup my MS Outlook email account on my ipad Air but none of the email folders/sub folders I have on my pc have synced with my email account on my ipad all I have is an inbox no sub folders at all. 
    How do I sync all my email folders in Microsoft Outlook so it will be anexact copy of my MS Outlook on my pc

    hayley7070 wrote:
    How do i sync all my iphone 5g photos and contact to my new windows computer. I am following the itunes instructions but they don't seem to apply
    What instructions?
    In the source list click devices (so far so good) then click the entry for your iphone or ipod.  that doesn't exist. HELP asap
    You don't import photos from the iPhone to your computer using iTunes.
    See this -> iOS: Importing personal photos and videos from iOS devices to your computer
    Note this only applies to photos taken with the iPhone. Any photos you previously added to your iPhone using iTunes should be copied from old computer to new computer.

  • Illustrator CS5 icons showing up on all folders when I open them with a grey "?" .links to CS5-

    I have illustrator CS5 icons showing up on all my folders when I open them with a grey "?" mark to the right, even when I open my HD*--When clicked on, the '?" shows zero data but this is a link to Illustrator CS5 that I need to undo. Please assist. Thank you.

    Here are Apple's instructions:
    If you are using iPhoto ’06 or earlier, you will need to follow these steps to tell iPhoto where the Library is now located:
    Hold down the Option key on the keyboard and open iPhoto. Keep the Option key held down until you are prompted to create or choose an iPhoto Library.
    Click Choose Library.
    Locate and select the iPhoto Library in its new location.
    (from http://support.apple.com/kb/HT1229 )
    Below (in the link below) is what you should see when holding down the option key and opening iPhoto. Keep holding down the option key until this dialogue comes up. You want to select the Choose Library button.
    http://appleclinic.wordpress.com/2008/04/06/change-default-dir-iphoto/

  • Can't see my files or folders when using accounts..

    I have 2 MyBook USB drives that I used to have connected to my Mac Mini that I today decided to move out in the closet and connect them to my Airport Extreme. Everything works fine as long as I set "Secure Shared Disks: With base station password", but when I select "With accounts" I can't seem to see any of my files or folders when I connect to the drives. I only get an empty drive. I can even add files or folders to it, and when I revert the changes I see my old files again, but not the new ones (unless I go back again).
    Anybody have a clue as to what might be wrong here?

    Here is how I fixed it on my end:
    First, unplugged the USB disk from AEBS and plugged in directly to my MacBookPro. Then, Get Info on the drive and selected "Shared Drive". Then, plugged it back into the AEBS and connected as a Guest.
    So far, works just fine. I can see all of my files on the external USB drive that is connect to the AEBS.
    Specs on my set up:
    Leopard 10.5.1
    MacBook Pro
    AEBS Firmware 7.2.1
    configured as a shared drive with Guest access (read & write)
    I have spent the past 5 hours working on this issue, including a call to Apple Tech Support.

  • Office 365 Outlook is now frozen. I cannot open outlook folders or mail. Can't access Options either. Works fine in IE.

    Office 365 Outlook is now frozen in Firefox.
    I cannot open Outlook folders or mail.
    Can't access Outlook Options either.
    Works fine in IE.
    Running latest Firefox, Win 7 and Office 365/Office 2010
    Cheers
    John

    LOL It worked! Thanks for your help. I will keep this handy in case I need to do it again!

  • I have an error when creating new folders, it renames the folder below it to the same name (super - next folder - parent's next sibling...)

    if I try to add a new folder to a sub folder, the program does add the new bookmark folder, but it also renames the next folder in line in the parent of the original "subfolder" to the exact same name...
    maybe I just need to reload the mozilla, maybe I was hacked and that is what they changed...
    I also have a similar problem with microsoft explorer, every time I try to add a new folder it gives it a starting wierd name besides "New Folder"
    I have an error when creating new folders, it renames the folder below it to the same name (super - next folder - parent's next sibling...)

    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

Maybe you are looking for

  • How to create View Object with Multiple Updatable Entity Objects

    I want both the entities in the view object to support creating new rows but when i give create insert it allows to insert only on the parent and not the child. I found this link http://docs.oracle.com/cd/E21043_01/web.1111/b31974/bcadvvo.htm#CEGCAJC

  • Need help my window is in thai and i dont understand at all.how to convert to english?

    need help my window is in thai and i dont understand at all. how to convert to english? i been trying for days but still cannot change it. because i cannot read thai..please help me step by step.. my pc is touchsmart 9100 windows 7 professional. Not

  • Purchase Analysis Question

    Hello experts i am not sure about something if happened before and i would like you knowledge about it. do you know if it is possible in Purchase Analysis, under Items tab to display Items that are in not buy mode(Purchase Item=No)? i am sure that it

  • Cfdocument doesn't work with my font size

    Hi All, My font size doesn't work inside my cfdocument using css Here is my code: In My css file I have this: body {     font-family:"times new roman";     font-size: 18px;     line-height: 20px; }  The font is a TTF and it shows in my cfadmin as: Fo

  • Problems with migration from Windows to Mac

    I recently purchased a new Macbook Pro and proceeded to move my Lightroom program and catalog to the new computer.  I have 77,000 digital image files stored on an external hard drive, so I placed my catalog on the external drive to make the move to t