Good evening Sue,
Thank you for your promptness and gracious reply.
I succeeded in resolving the above issues. I think the following line was
the origin of the exception:
7 customPropFolder.WebViewURL =
RegisterFolderHomepage.RegisterType(typeof(FolderH omepageUC),
customPropFolder.Name);
I might be wrong.
It looks like you cannot attach a registered custom folder page to a folder
that is a child of the root folder. The same code I shared with you works
fine if I remove the “Parent” property from it.
But now, it looks like I have another issue to tackle:
Once you have the Folder home page up and running, how do you get rid of the
default view of that folder?
The folder I am creating and customizing is an empty folder (serves only as
a trigger) that, when selected, its home page would display Panel Controls
with various data driven controls.
The problem I am having at this point is that the home page is showing the
desired layout, but on top of that, it is also showing the tableView columns
for an email item right underneath my WPF user control. I understand why the
view schema is attached to the folder; I just don’t know how to disable it.
I looked at some of the samples that show you how to create a custom view
with a customized schema, but, in my case, that is not what I want. To
visualize things for you: I want to be able to click on the folder on the
navigation panel, and on the right, inside the folder's custom home page, I
want the form (with the data driven controls) to take up all that space [no
view at all].
Thank you Sue for your help and your patience
------------------------------------------------------
"Sue Mosher [MVP-Outlook]" wrote:
Which statement raises the error?
You probably should use Folder instead of MAPIFolder, given that you're coding for Outlook 2007.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"Naji" wrote in message ...
Good Morning Sue,
Here is the link to the sample I am experimenting with:
http://www.microsoft.com/downloads/d...displaylang=en
and here is some of the code I am put together:
1 private void ThisAddIn_Startup(object sender, System.EventArgs e)
2 {
3 Outlook.MAPIFolder customPropFolder =
CustomPropertiesFolder(this.Application.Session);
4
5 if (customPropFolder != null)
6 {
7 customPropFolder.WebViewURL =
RegisterFolderHomepage.RegisterType(typeof(FolderH omepageUC),
customPropFolder.Name);
8 customPropFolder.WebViewOn = true;
9 customPropFolder.Display();
10 }
11 }
12
13 private Outlook.MAPIFolder CustomPropertiesFolder(Outlook.NameSpace
session)
15 {
16 string folderName = "Special Folder";
17 Outlook.MAPIFolder rootFolder =
(Outlook.MAPIFolder)session.GetDefaultFolder(Outlo ok.OlDefaultFolders.olFolderInbox).Parent;
18 Outlook.MAPIFolder customPropFolder = null;
19 foreach (Outlook.MAPIFolder _folder in rootFolder.Folders)
20 {
21 if (_folder.Name == folderName)
22 customPropFolder = _folder;
23 }
24
25 try
26 {
27 if (customPropFolder == null)
28 {
29 customPropFolder = rootFolder.Folders.Add(folderName,
Outlook.OlDefaultFolders.olFolderInbox);
30 }
31 }
32 catch (Exception ex)
33 {
34 System.Windows.Forms.MessageBox.Show(ex.Message);
35 }
36
37 return customPropFolder;
38 }
All I am doing to the sample (at the link provided above) is changing the
occurrences of "Outlook.OlDefaultFolders.olFolderTasks" to
"Outlook.OlDefaultFolders.olFolderInbox". Before the change, the sample works
fine, but after the change it breaks.
If I can get the sample to behave properly, my problem (to add a folder
with a custom homepage to the root folder) would be solved.
I am using VS 2008 and Outlook 2007
Please advise as to the best way to achieve the following:
1) I want to be able to click on a button that resides in the Explorer
Toolbar, and display a custom explorer window with different controls.
I have already tried to follow the steps outlined in this sample:
"OutlookAddin_FolderHomepageView_Sample", but, in my case, it seems to work
only for the Tasks Folder, but it would not work for the Default Inbox
folder. I keep getting: "Object does not support this property or method"