Folder Custom View

  • Thread starter Thread starter Naji
  • Start date Start date
N

Naji

Hello everyone,

Thank you for your assistance.

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"

2) Can a web page that is showing inside Outlook browser exchange
parameters with the outlook explorer that is showing that page?

thank you.
 
1) You get an error on what statement? Show enough of the code that people who might respond can know what you code you're working with.

2) Exchange parameters in what way?

It might help if you explained why you think a folder home page is a good solution, instead of a custom task pane.
 
Good Morning Sue,

Here is the link to the sample I am experimenting with:


http://www.microsoft.com/downloads/...94-f008-4054-82e4-d591a2574168&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(FolderHomepageUC),
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(Outlook.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.

As to your second question, I was wandering if the following would be
possible:
• Can an ASP.Net page sense its outlook browser environment, and based on
that be able to open inspectors and change MailItem properties before item is
sent?

A custom task pane is definitely one of the options I have considered, but a
custom explorer window (AKA, folder home page) is much more effective and, in
my opinion, a better design. Of course it is more challenging.

I am open to suggestions, suggestions I can hopefully code.

Thank you so much for your time and effort.
 
An ASP.NET page cannot respond to Outlook events. It can perform Outlook automation using client-side VBScript or JScript. In other words, all the Outlook code would have to be client code, not server code.
 
Which statement raises the error?

You probably should use Folder instead of MAPIFolder, given that you're coding for Outlook 2007.
 
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(FolderHomepageUC),
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
 
Is customPropFolder a valid Folder object? What does RegisterFolderHomepage.RegisterType do? It needs to return the URL string for the folder home page you want to show.

If you don't want to show the list of items in the folder at all, then don't use an Outlook View Control on your folder home page.

--
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 said:
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(FolderHomepageUC),
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 said:
Which statement raises the error?

You probably should use Folder instead of MAPIFolder, given that you're coding for Outlook 2007.
 
Back
Top