Folder Permissions

J

Jack

I have a routine that walks through the connected folders in Outlook and
inspects several of the properties. This works fine until it encounters a
folder that is does not have enough permissions to and throws an error.

Question:
Is there a way to determine if you have access to a folder before throwing
an error trying to inspect a property that you do not have access?

Jack
 
P

Peter Huang [MSFT]

Hi Jack,

Here I assume you are caring the folder on the Exchange Server when you
access using Outlook.
Because if this is folder pointed to local file, you have permission to it.

Based on my research, the Outlook Object Modal did not provide such
method/properties to detect the permission of a folder.
For your scenario, I would suggest you a Try..Catch block to detect the
permisson, so that the exception will throw up to break your application.

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
K

Ken Slovak - [MVP - Outlook]

The folder properties PR_ACCESS (0x0FF40003) and PR_ACCESS_LEVEL
(0x0FF70003) provide that information, but as Peter mentioned they aren't
exposed in the Outlook object model. CDO 1.21 or Extended MAPI or some other
low level API like that would be needed to access those properties.

Neither Extended MAPI or CDO 1.21 are supported for use with .NET code
however.
 
J

Jack

Peter/Ken,

Thanks for the feedback.

What I ended up doing is instead of using the try-catch exception handling I
am using the on error resume next and then checking for err.number <> 0 to
see if it throws and error and assuming that error is due to a permissions
problem. Just was hoping there was a more graceful approach.

Thanks,

Jack
 
P

Peter Huang [MSFT]

Hi Jack,

Thanks for your quickly reply!
Also I think you may try the MAPI specified newsgroup if you wants to turn
to the MAPI approach per Ken's suggestion.
microsoft.public.win32.programmer.messaging

The newsgroup above is primarily for issues involving low level MAPI
programming. We recommend posting appropriately so you will get the most
qualified pool of respondents, and so other communties who regularly read
the newsgroups can either share their knowledge or learn from your
interaction with us.

Thanks for your understanding!

If you have any concern with this question, please feel free to post here.


Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jack

Here is what I ended up doing.

I created a .NET DLL that has one function (ValidFolder) that accepts a
folder as a parameter. It takes that folder and looks at the entryid and
storeid properties, if it throws an error then it returns false (assuming
that I do not have permission) if not it reruns true. Kind of brute force
but it seems to work and allows me to use my try/catch exception handling in
my main program and eliminate all the on error logic.

Code for the function/dll:

Public Function ValidFolder(ByVal oFolder As Object) As Boolean

Dim tmpEntryID, tmpStoreid As String

On Error GoTo ErrTrap

tmpEntryID = oFolder.EntryID

tmpStoreid = oFolder.StoreID

ErrTrap:

If Err.Number <> 0 Then

ValidFolder = False

Else

ValidFolder = True

End If

End Function

Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top