Outlook – get items inbox from shared mailbox

Welcome Forums General PowerShell Q&A Outlook – get items inbox from shared mailbox

Viewing 0 reply threads
  • Author
    Posts
    • #213537
      Participant
      Topics: 3
      Replies: 21
      Points: 67
      Rank: Member

      Hello a used this code for get items inbox from shared mailbox, but return blank. Can I help me, please?

       

      $class = @”
      using Microsoft.Office.Interop.Outlook;
      public class MyOL{
      public MAPIFolder GetInbox(string userName){
      Application oOutlook = new Application();
      NameSpace oNs = oOutlook.GetNamespace(“MAPI”);
      Recipient oRep = oNs.CreateRecipient(userName);
      MAPIFolder inbox = oNs.GetSharedDefaultFolder(oRep, OlDefaultFolders.olFolderInbox);
      return inbox;
      }
      }
      “@
      Add-Type -AssemblyName Microsoft.Office.Interop.Outlook
      Add-Type $class -ReferencedAssemblies Microsoft.Office.Interop.Outlook
      $MyOL = New-Object MyOL
      $email = $MyOL.GetInbox(‘test@email.com’)

Viewing 0 reply threads
  • You must be logged in to reply to this topic.