Pieter van der Westhuizen
Posts: 25
Joined: 2009-02-18
|
I want to show a custom form using the webview pane option on the Outlook forms manager for a specific folder named MyFolder. However, even though I type in the folder name in the FolderName and FolderNames properties it does'nt show.
However if I change the FolderName property to Personal Folders it works.
Please assist.
Thank you. |
|
Eugene Astafiev
Guest
|
Hello Pieter,
You need to use the following format of the string:
Personal Folders\MyFolder |
|
Pieter van der Westhuizen
Posts: 25
Joined: 2009-02-18
|
Hi Eugene,
Thanks for the response. It just needs a \ between Personal Folders and MyFolder e.g. Personal Folders\MyFolder
Thanks |
|
Eugene Astafiev
Guest
|
Right. You are welcome, Pieter. |
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
Peter,
You can get the name of the folder in the OnInitialize event of the Outlook Forms Manager:
...
Outlook.NameSpace ns = OutlookApp.Session;
Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
adxOlFormsCollectionItem1.FolderName = GetFolderPath(inbox);
Marshal.ReleaseComObject(inbox);
Marshal.ReleaseComObject(ns);
...
private string GetFolderPath(Outlook.MAPIFolder folder)
{
string path = "";
bool toBeReleased = false;
object tempObj = null;
while (folder != null)
{
path = "\" + folder.Name + path;
if (tempObj != null)
Marshal.ReleaseComObject(tempObj);
try
{
tempObj = folder.Parent;
}
catch
{
//permissions aren't set
tempObj = null;
}
finally
{
if (toBeReleased)
Marshal.ReleaseComObject(folder);
else
//the caller will release the folder passed
toBeReleased = true;
folder = null;
}
//The parent of a root folder is of the Outlook.Namespace type
if (tempObj is Outlook.MAPIFolder)
folder = tempObj as Outlook.MAPIFolder;
}
if (tempObj != null)
Marshal.ReleaseComObject(tempObj);
if (path != "")
path = path.Substring(1);
return path;
}
Andrei Smolin
Add-in Express Team Leader |
|