-1

I have 20 shared mailboxes in my current outlook application. I tried extracting and displaying email by using ItemAdd and ItemSend for current outlook profile which is my personal (nvreddy@domain.com) and succeeded. but when I am tried for shared mailboxes I got failed and no idea where to start to get extraction of email receive and send for share mailboxes.

how can I make sure Outlook VBA to identify and display if any new email receives to any shared mailbox and sends from any shared mailbox. I hope I have explained my best here as I am new bee here.

Thanks in advance.

NVReddy
  • 52
  • 6
  • Does this answer your question? [Get reference to additional Inbox](https://stackoverflow.com/questions/9076634/get-reference-to-additional-inbox) – niton Jul 24 '20 at 17:16
  • https://stackoverflow.com/a/34952936/4539709 – 0m3r Jul 24 '20 at 19:46

1 Answers1

0

You need to use the NameSpace.GetSharedDefaultFolder method to get a Folder object that represents the specified default folder for the specified user.

Sub ResolveName() 
 Dim myNamespace As Outlook.NameSpace 
 Dim myRecipient As Outlook.Recipient 
 Dim CalendarFolder As Outlook.Folder 
 
 Set myNamespace = Application.GetNamespace("MAPI") 
 
 Set myRecipient = myNamespace.CreateRecipient("Eugene Astafiev")
 myRecipient.Resolve 
 If myRecipient.Resolved Then 
 Call ShowCalendar(myNamespace, myRecipient)
 End If 
End Sub 
 
Sub ShowCalendar(myNamespace, myRecipient) 
 Dim CalendarFolder As Outlook.Folder 
 
 Set CalendarFolder = myNamespace.GetSharedDefaultFolder(myRecipient, olFolderCalendar) 
 CalendarFolder.Display 
End Sub

As soon as you have retrieved an instance of the Folder class you can add an ItemAdd event handler.

The ItemSend event is fired only for the accounts configured in your profile.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thank you for addressing but ... Set sharedemail = objectNS.CreateRecipient("Viswanathareddy.Nitturu@conduent.com") **Set sentitem = objectNS.GetSharedDefaultFolder(sharedemail, olFolderSentMail).Items** bold line throwing error as "Run time error '-2147024809(80070057). would you please advice as difficulty in accessing the Shared sent items as Shared inbox is easy way with your approach. – NVReddy Jul 27 '20 at 16:02
  • sorry for delayed response I have tried resolving this issue but no luck. as of now due other things I have parked it. definitely I will try and let you know. – NVReddy Aug 14 '20 at 14:48