cancel
Showing results for 
Search instead for 
Did you mean: 

Reading "Sent Items" from a shared mailbox

a026833
Level 4
I have seen others ask this question but have not seen a response. I am able to read the inbox of a shared folder without issue (using action "get Received Items Basic") however I cannot do the same for "Sent Items" folder (using action "Get Sent Items Basic"). Getting this message (below), any ideas as to why this is happening?
Thanks You!

29684.png
29686.png

------------------------------
June Siravo
Analyst
FIAM
America/New_York
------------------------------
4 REPLIES 4

HanumanthYemmet
Level 3
Hi June,

is the mailbox is default one or Shared mailbox?

if its shared then you can try the below code (you need edit the code for "sent folder")


Dim app = CreateObject("Outlook.Application")
Dim _nameSpace = app.GetNameSpace("MAPI")

Dim folder

folder = _nameSpace.Folders(MailBoxName)
If SubFolder <> "" Then
For each name as string in SubFolder.Split("\")
folder = folder.Folders(name)
Next
End If

Dim dataTable As New Data.DataTable
dataTable.Columns.Add("EntryID", Type.GetType("System.String"))
dataTable.Columns.Add("To", Type.GetType("System.String"))
dataTable.Columns.Add("CC", Type.GetType("System.String"))
dataTable.Columns.Add("Subject", Type.GetType("System.String"))
dataTable.Columns.Add("Body", Type.GetType("System.String"))
dataTable.Columns.Add("Attachments", Type.GetType("System.String"))
dataTable.Columns.Add("ReceivedOn", Type.GetType("System.DateTime"))
dataTable.Columns.Add("SentOn", Type.GetType("System.DateTime"))
dataTable.Columns.Add("SenderName", Type.GetType("System.String"))
dataTable.Columns.Add("SenderEmailAddress", Type.GetType("System.String"))
dataTable.Columns.Add("Unread", Type.GetType("System.Boolean"))

Dim folderItems = If(Filter_Expression <> "", folder.Items.Restrict(Filter_Expression), folder.Items)

For Each item As Object In folderItems
If Not TypeOf item Is MailItem Then Continue For
Dim row As Data.DataRow = dataTable.NewRow
row("EntryID") = item.EntryID
row("To") = item.To
row("CC") = item.CC
row("Subject") = item.Subject
row("Body") = item.Body

Dim attachments As String = ""
For Each attachment As Object In item.Attachments
If attachment.Type = 1 Then
attachments = attachments & "|" & attachment.DisplayName
End If
Next

row("Attachments") = If (attachments.Length = 0, "", attachments.SubString(1))
row("SentOn") = item.SentOn
row("ReceivedOn") = item.ReceivedTime
row("SenderName") = item.SenderName
row("SenderEmailAddress") = If (item.SenderEmailType = "EX",item.Sender.GetExchangeUser.PrimarySmtpAddress,item.SenderEmailAddress)
row("Unread") = item.Unread
dataTable.Rows.Add(row)
Item_Count += 1
Next
Items = dataTable

------------------------------
Hanumanth Yemmetti
Senior Developer
Shell
Asia/Kolkata
------------------------------

ewilson
Staff
Staff
Hi @June Siravo,

Can you tell me if your local instance of Outlook has the Use Cached Exchange Mode option enabled?​ What about the Download Shared Folders option?

29662.png
In the past, we've found that both of these options can contribute to issues with accessing shared mailboxes and folders from the local Outlook instance.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi Eric,
I tried changing the Exchange settings as you suggested, then closed and reopened Outlook but no luck, still getting the same error (see below), :29665.png 

29666.png





------------------------------
June Siravo
Analyst
FIAM
America/New_York
------------------------------

Hi @June Siravo,

Ok, go ahead and put those settings back the way they were. I've been tinkering with the Outlook VBO today and I did notice the I've started to have some issues with accessing the Shared Mailbox on our test system. As a result, we went back and adjusted the code of the VBO a bit to basically use two different methods of trying to get a pointer to a folder (this applies to Received and Sent items as well as Shared Mailboxes).

There's a new version of the VBO (v6.10.6) on the DX now. I'd suggest grabbing the latest version and giving it a try.

Cheers,​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------