Torsten Lang
Posts: 3
Joined: 2006-11-08
|
After studying your examples of your Outlook Developer Tricks I always noticed that you entered the name of the inbox's parent folder hardcoded.
Since the "Personal Folders"-folder of every computer might be called differently I am wondering if there is a way to get the name dynamically.
We plan to add a new folder being a sibling of the inbox-, contacts, outbox-, etc folder, but to do so we need the name of the root folder.
Usually it would be "Personal Folders", but my Outlook for example has no "Personal Folders" due to the localization, it is called differently ("Postfach - [forename lastname]").
I managed to get the whole folder structure, but this doesn't really help me as my "Personal Folders" has a folder as sibling on the same level called "public folders", aswell there might be more folders on the same level.
I have been searching for hours to get the folder object that holds my inbox as child (with poor success) and I'd pretty much appreciate any help. |
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Torsten,
You can try to use the code below:
function GetFullFolderName(const AFolder: MAPIFolder): WideString;
var
IDisp: IDispatch;
Folder: MAPIFolder;
begin
Result := '';
try
Folder := AFolder;
while Assigned(Folder) do begin
Result := '' + Folder.Name + Result;
IDisp := Folder.Parent;
if Assigned(IDisp) then
IDisp.QueryInterface(IID_MAPIFolder, Folder)
else
Folder := nil;
end;
if Result <> '' then Delete(Result, 1, 1);
except
// mailbox permissions
end;
end;
var
S: WideString;
IInbox: MAPIFolder;
begin
IInbox := OutlookApp.GetNamespace('MAPI').GetDefaultFolder(olFolderInbox);
if Assigned(IInbox) then
try
S := GetFullFolderName(IInbox);
ShowMessage(S);
finally
IInbox := nil;
end;
end;
P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
|
|
Torsten Lang
Posts: 3
Joined: 2006-11-08
|
Working like a charm,
thank you :) |
|