Webview pane in subfolder

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

Webview pane in subfolder
 
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.
Posted 18 Feb, 2009 14:04:30 Top
Eugene Astafiev


Guest


Hello Pieter,

You need to use the following format of the string:

Personal Folders\MyFolder
Posted 19 Feb, 2009 04:27:33 Top
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
Posted 19 Feb, 2009 05:30:30 Top
Eugene Astafiev


Guest


Right. You are welcome, Pieter.
Posted 19 Feb, 2009 06:07:34 Top
Andrei Smolin


Add-in Express team


Posts: 18829
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
Posted 19 Feb, 2009 08:02:58 Top