How to check if an Outlook Email is in Read-Only mode ?

Add-in Express™ Support Service
That's what is more important than anything else

How to check if an Outlook Email is in Read-Only mode ?
How to check if an Outlook Email is in Read-Only mode ? 
Jun Wei Ng


Guest


Hi There,

I have an Outlook Email contains an email attachment.

When I open the email attachment, the email can be opened but it is in read-only mode.

Is there any way I can check is the email in read-only mode programmatically ?

Outlook is unlike Word, in word object, we can still use the following code to check whether the document is in read-only mode or not:

Dim activeDoc As Word.Document = appWord.ActiveDocument
If activeDoc.ReadOnly = True Then
// continue the process
End If

Best Regards,
Jun Wei
Posted 09 Dec, 2019 05:09:18 Top
Andrei Smolin


Add-in Express team


Posts: 18817
Joined: 2006-05-11
Hello Jun Wei,

An email opened for reading is read-only. See Mailitem.Sent; see https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem.sent. If that property is true, the email is readonly. If not, the user may change it. The email is changed if MailItem.Saved is false.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Dec, 2019 06:54:12 Top
Jun Wei Ng


Guest


Hi Andrei,

Appreciate the solution that you provided but I dont think it can be used to do the checking as it is not very accurate.

Is there any proper way like using Word Object to check the opened email attachment is in read only mode ?

My scenario as below:

An email contains an email attachment, when I open the email attachment, it stated that the email attachment is in read only mode. When I do certain actions (I integrated my own function with Outlook), exception occurred saying that 'You don't have appropriate permission to perform this operation.'

It throws exception when go through this line:

Outlook.MailItem.SaveAs(path, Outlook.OlSaveAsType)

Kindly assist.

Best Regards,
Jun Wei
Posted 09 Dec, 2019 22:05:18 Top
Jun Wei Ng


Guest


Hi Andrei,

Any update on this issue ?

Best Regards,
Jun Wei
Posted 11 Dec, 2019 23:36:09 Top
Andrei Smolin


Add-in Express team


Posts: 18817
Joined: 2006-05-11
Hello Jun,

Sorry for misunderstanding.

Jun Wei Ng writes:
When I open the email attachment, the email can be opened but it is in read-only mode.


Could you please explain this? I don't understand "read-only mode". Is this mode in any way different from what you get if you open a received email by double-clicking it?


Andrei Smolin
Add-in Express Team Leader
Posted 12 Dec, 2019 04:06:47 Top
Jun Wei Ng


Guest


Hi Andrei,

My scenario as below:

An email contains an email attachment, when you double click to open that email attachment, at the top you will see '[The Subject of the e-mail attachment](Read-Only)'.

This is what I meant.

When I use my own function integrated with Outlook, I hit the 'You don't have appropriate permission to perform this operation.' exception.

Best Regards,
Jun Wei
Posted 12 Dec, 2019 20:41:57 Top
Andrei Smolin


Add-in Express team


Posts: 18817
Joined: 2006-05-11
Hello Jun,

I haven't found how to identify such an email. At https://social.msdn.microsoft.com/Forums/officeocs/en-US/dd1b6b5c-3175-4bad-86f3-08cccd94c8cc/outlook-2010-you-dont-have-appropriate-permission-to-perform-this-operation?forum=outlookdev, Ken Slovak says that such a attachment is placed in a secure temp folder and the item is opened from there. In my tests however, the Outlook object model reports that that item is opened from Inbox.

I suggest that you ask this question on the Outlook for Developers forum at https://social.msdn.microsoft.com/Forums/en-US/home?forum=outlookdev. I'd recommend that your description contains the string "email opened from attachment".

May I ask you to publish here a link to your question on that forum?


Andrei Smolin
Add-in Express Team Leader
Posted 13 Dec, 2019 05:53:18 Top