Get items in search folder for shared mailbox

Status
Not open for further replies.

Van Fog

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Hi,

I am using Outlook 2007 (don’t laugh!).

I am trying to process items in a search folder for a shared mailbox.

I am trying to use the following line, which works well for my primary mailbox:
Session.Stores.Item(StoreName).GetSearchFolders(SourceFolder)

This line does not work for the shared mailbox, however.

In searching online, I have found the following site: https://social.msdn.microsoft.com/F...s-of-shared-mailbox-with-vba?forum=outlookdev

The suggestion in that thread is that the only way to get the items is via Extended MAPI (C++ or Delphi) or Redemption (which wraps Extended MAPI).

In the following thread, the suggestion is that AdvancedSearch doesn’t work for searching subfolders in shared mailboxes, and that “you'd need to get the shared Inbox and recursively get each subfolder and then run a search or a filter operation on the Folder.Items collection, or use GetTable() with a filter”:
http://msdn.developer-works.com/article/11548778/application+advanced+search+in+a+shared+mailbox

Question: Can someone please point me in the right direction for getting the items in the search folder (Redemption if not an option)? I’m happy to figure out the details on my own, but am just after a pointer in the right direction. Can I write a small function in C++, and then reference that using VBA? Or following the second article, how would I process items in folders recursively (does anyone have an example I can learn from) and/or use GetTable()?

Any help would be greatly appreciated! :)


Thanks,

Van
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
AdvancedSearch doesn’t work for searching subfolders in shared mailboxes,

Correct. Only accounts in your profile can search subfolders (or properly group conversations when messages are in other folders) - shared mailboxes are searched one folder at a time, as are public folders. If the mailbox is in online (not cached) exchange handles the search and it might work.

Here is a readable version of the second link - https://social.msdn.microsoft.com/F...d-search-in-a-shared-mailbox?forum=outlookdev

This link - https://social.technet.microsoft.co...ed-mailbox-search-on-subfolders?forum=outlook - says it works if you are in the folders module. I haven't verified it and i don't know if that would make a difference when using VBA to search.
 

Van Fog

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Thanks Dianne.

I am confused though, because with the search folders I have, I am able to filter across subfolders. See below, where the 'Matter' column is a relabelled 'In Folder' column:

AidRWfC.png


I am in Online mode, though, and not cached mode.

So I guess I am back to the idea that this can be done via a script, as it can be done via the GUI in the screenshot above, but to do so requires use of Extended MAPI (C++ or Delphi) or Redemption... or otherwise individually recursing through all subfolders, getting all items, and going from there. Boo.

If anyone would be able to point me in the direction of sample scripts for recursing subfolders individually and getting all items, this would be much appreciated.


Thanks,

Van
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Yes, online makes a difference - you can search across shared mailbox folders if using online mode. I'd use redemption - it makes accessing ExMAPI much easier - and Dmitry might have some samples online that can point you in the right direction.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Sent mail not showing in Sent Items folder; but they can be found with Search Using Outlook 3
S VBA Code to move mail items from search folder to inbox subfolder Outlook VBA and Custom Forms 4
S Loop mail items within a Custom Search Folder Outlook VBA and Custom Forms 1
T How can you include Junk Email in Search Results like you can include Deleted Items? Using Outlook 3
King Mustard Sort search groups by amount of items? Using Outlook 1
A OL13 Calendar Search not finding most items Using Outlook 15
J Cannot search items within shared calendar Using Outlook 0
D Autosort macro for items in a view Outlook VBA and Custom Forms 2
J Names in sent items suddenly show as Bob Smith (bobsmith@sample.com) Using Outlook 3
M Messages Intermittently Dont Arrive In Sent Items After Sending Successfully Using Outlook 4
D Outlook 2016 Outlook not saving Sent Items Using Outlook 4
G Retention Policy for Outlook.com Deleted Items folder Using Outlook 0
M Outlook on 3 Computers Shows Different Total Items on Same Account Using Outlook 3
B oContacts.Items.Restrict Misses Some Contacts Outlook VBA and Custom Forms 3
T Changing Sent Items location in Outlook 2019 Using Outlook 0
K Use VBA to find Sender and Recipient from Microsfot 365 Journaled Email Items Outlook VBA and Custom Forms 3
A Connect to server to views items Using Outlook 0
D Mail in Sent Items Gone Using Outlook 12
R How to get the Items object of the default mailbox of a specific account in a multiple account Outlook? Outlook VBA and Custom Forms 0
A Cannot copy this folder because it may contain private items Using Outlook 0
GregS Outlook 2016 Sent Mail absent from Sent Mail or Sent Items Folders Using Outlook 4
C How to use VBA to show only items x days old or more Outlook VBA and Custom Forms 1
T Increasing the number of items that appear on the Categories list Using Outlook 2
J Sent Items Folder NOT Showing Correct From Email Address Using Outlook 0
C Pull Outlook shared calendars items from Excel Outlook VBA and Custom Forms 4
J Outlook Reply > From > Other Email Address... > Address Not Showing in Sent Items... From Email Outlook VBA and Custom Forms 0
GregS Outlook 2016 Sent Items vs Sent Messages Using Outlook 2
A Order of Recent Items in Attach File List Using Outlook 5
W Outlook 2010 some sent items marked unread now (was Ok before) Using Outlook 0
D Unopened message in inbox deleted and not in deleted items Using Outlook 3
T "cannot find the calendar folder for this item" - calendar items stuck in outbox Using Outlook 0
R Exporting recovered Deleted Items outside the Inbox Using Outlook 1
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
O Outlook 365 - Toolbar - Close all items - missing? Using Outlook 3
B Clear Offline Items (Mail Folder) via VBA Outlook VBA and Custom Forms 1
A Move email items based on a list of email addresses Outlook VBA and Custom Forms 40
R Retention periods and Deleted Items Using Outlook 7
V Items missing in Sent folder Using Outlook 10
P Deleted Items - Unable to Iterate All of Items Outlook VBA and Custom Forms 1
P How do I convert outlook “to-do” items to “tasks” Outlook VBA and Custom Forms 1
N Tracking Mail items being moved to folders Outlook VBA and Custom Forms 5
icacream Can't the Deleted Items Folder be self cleaning ? Using Outlook 2
N Selecting multiple calendar items Using Outlook 4
S Display PF contact folder items to select contact to link to appointment Outlook VBA and Custom Forms 1
M Sent Items Folder is Present but Not Displayed Using Outlook 2
B Saving items under a folder Using Outlook 3
M Outlook.com autocomplete list invaded by strange items Using Outlook.com accounts in Outlook 7
O How to display number of items per .pst file Using Outlook 7
S Show Total Number Of Items Not Displaying Using Outlook 9
M How many days are items in Recover Deleted at Outlook.com ? Using Outlook.com accounts in Outlook 4

Similar threads

Top