PC Review


Reply
Thread Tools Rate Thread

determine local/remote folder

 
 
Rasmus Watjen
Guest
Posts: n/a
 
      16th Aug 2005
When getting the folder tree from Outlook starting at NameSpace.Folders,
and then Folder.Items[i].Folders, etc., how can I determine whether a
folder is located in the following:

PST file
User's own mailbox
Public folders


Thank you.

Rasmus
 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      16th Aug 2005
What version or versions of Outlook do you intend to support? What API's are
you using for Outlook?

If using Outlook 2003 for example you can use this:
NameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders )

to get the All Public Folders folder as a MAPIFolder. You can then read the
StoreID of that folder and use it for comparison with other folders to see
if the store is a public folders store.

Using GetDefaultFolder(olFolderInbox) to get a MAPIFolder and then its
StoreID will give you the id for the default store, mailbox or PST file.

Convert the StoreID into a Byte array of binary values and then convert that
into a string. If inside the string you find "EMSMDB.DLL" it's an Exchange
store. If inside the string you find "MSPST.DLL" or "PSTPRX.DLL" it's a PST
file.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Rasmus Watjen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When getting the folder tree from Outlook starting at NameSpace.Folders,
> and then Folder.Items[i].Folders, etc., how can I determine whether a
> folder is located in the following:
>
> PST file
> User's own mailbox
> Public folders
>
>
> Thank you.
>
> Rasmus


 
Reply With Quote
 
Rasmus Watjen
Guest
Posts: n/a
 
      16th Aug 2005
Ken Slovak - [MVP - Outlook] wrote:
> What version or versions of Outlook do you intend to support? What API's
> are you using for Outlook?

I would like to support Outlook 2000 and newer. I am using the COM
interface, but the same methods should work inside Outlook in VBA.
The connection code is:
outlook = CreateOleObject('Outlook.Application');
NameSpace = outlook.GetNameSpace('MAPI');
etc.

>
> If using Outlook 2003 for example you can use this:
> NameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders )
> to get the All Public Folders folder as a MAPIFolder. You can then read
> the StoreID of that folder and use it for comparison with other folders
> to see if the store is a public folders store.

I like that way because it is simple to do on a folder-by-folder basis.
Is it possible to do something similar in versions prior to 2003? It
must support foreign language installations, so I cannot simply search
for the "Public folders" folder, it may be named something else.

>
> Using GetDefaultFolder(olFolderInbox) to get a MAPIFolder and then its
> StoreID will give you the id for the default store, mailbox or PST file.

The default folder for inbox may be located in a public folder, is that
not correct? So the store id would not be the same as a folder located
in the user's own mailbox?

>
> Convert the StoreID into a Byte array of binary values and then convert
> that into a string. If inside the string you find "EMSMDB.DLL" it's an
> Exchange store. If inside the string you find "MSPST.DLL" or
> "PSTPRX.DLL" it's a PST file.

That is nice to know.

Thank you for your tips so far.

Best regards,
Rasmus
 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      17th Aug 2005
When you get the default Inbox folder it's always in your default mailbox or
PST file. It can never be in a non-default store or a public folder.

Unfortunately the only language-independent method of seeing if a folder is
in a public folder store uses CDO 1.21 (optional installation with Outlook
2000 and later). It can also be done with Extended MAPI (C++ or Delphi code
only) or the forthcoming version of Redemption (www.dimastr.com) using the
new RDOSession object.

CDO 1.21 code would look something like this:

Public Function IsPublicFoldersStore(strStoreID As String) As Boolean
Dim g_objCDO As MAPI.Session
Dim objRootFolder As MAPI.Folder
Dim objField As MAPI.Field
Dim objStore As MAPI.InfoStore

On Error Resume Next

Set g_objCDO = CreateObject("MAPI.Session")
g_objCDO.Logon "", "", False, False

Set objStore = g_objCDO.GetInfoStore(strStoreID)

With objStore
If .ProviderName = "Microsoft Exchange Server" Then
Set objRootFolder = .RootFolder
If objRootFolder.Name = "IPM_SUBTREE" Then
Err.Clear
Set objField = .Fields.Item(PR_IPM_PUBLIC_FOLDERS_ENTRYID)
If Err Then
IsPublicFoldersStore = False
Else
If objField <> "" Then
IsPublicFoldersStore = True
Else
IsPublicFoldersStore = False
End If
End If
Else
IsPublicFoldersStore = False
End If
Else
IsPublicFoldersStore = False
End If
End With

Set objRootFolder = Nothing
Set objField = Nothing
Set objStore = Nothing
End Function

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Rasmus Watjen" <(E-Mail Removed)> wrote in message
news:Ojj$(E-Mail Removed)...
> Ken Slovak - [MVP - Outlook] wrote:
>> What version or versions of Outlook do you intend to support? What API's
>> are you using for Outlook?

> I would like to support Outlook 2000 and newer. I am using the COM
> interface, but the same methods should work inside Outlook in VBA.
> The connection code is:
> outlook = CreateOleObject('Outlook.Application');
> NameSpace = outlook.GetNameSpace('MAPI');
> etc.
>
>>
>> If using Outlook 2003 for example you can use this:
>> NameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders )
>> to get the All Public Folders folder as a MAPIFolder. You can then read
>> the StoreID of that folder and use it for comparison with other folders
>> to see if the store is a public folders store.

> I like that way because it is simple to do on a folder-by-folder basis. Is
> it possible to do something similar in versions prior to 2003? It must
> support foreign language installations, so I cannot simply search for the
> "Public folders" folder, it may be named something else.
>
>>
>> Using GetDefaultFolder(olFolderInbox) to get a MAPIFolder and then its
>> StoreID will give you the id for the default store, mailbox or PST file.

> The default folder for inbox may be located in a public folder, is that
> not correct? So the store id would not be the same as a folder located in
> the user's own mailbox?
>
>>
>> Convert the StoreID into a Byte array of binary values and then convert
>> that into a string. If inside the string you find "EMSMDB.DLL" it's an
>> Exchange store. If inside the string you find "MSPST.DLL" or "PSTPRX.DLL"
>> it's a PST file.

> That is nice to know.
>
> Thank you for your tips so far.
>
> Best regards,
> Rasmus


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote shared folder changes location to local computer Matt Windows XP Networking 0 9th Jul 2008 02:58 PM
how to restrict remote user to local drives and give access to a folder only. Jon L. Miller Microsoft Windows 2000 File System 0 18th Aug 2005 09:12 AM
maping a remote ftp folder to local drive is this possible? geos Windows XP General 3 8th Sep 2004 07:45 PM
maping a remote ftp folder to local drive is this possible? geos Microsoft Windows 2000 3 8th Sep 2004 07:45 PM
maping a remote ftp folder to local drive is this possible? geos Microsoft Windows 2000 Networking 3 8th Sep 2004 07:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:54 PM.