the preliminary Outlook 2007 developers documentation lists a Delete() and
a Remove() method. I have tried both of these methods in an attempt to
remove a standard view from the collection. I am able to remove a custom
view that I have added myself using these methods. However I am unable to
remove a standard view because I get a COM error.
The reason I am trying to do this is because I have set up a new
NavigationPane folder based on a custom MAPI Folder that I have created.
When a user clicks to insert a new item or edit an item from this MAPI
Folder, the form region I am exposing replaces the default Contacts form
and only user defined fields are visible. Urgo when a user clicks my
navigation folder, I do not want to display a list of Views to a user that
are based on the standard Outlook Contacts item. This does not make sense
as my resulting form will not expose these fields, so why would they want
to see them listed in its View?. Instead I want a customised Views list
which shows only my user defined fields.
it seems to me that if Microsoft are allowing developers to create form
regions which completely override and customise the original Contacts
form, then it follows that I would also need this for the Views on the
navigation pane as well?
this is a big sticking point for me as I cant seem to get info about how
to solve this. I will try your suggestion Sue. any more suggestions/help
from anybody would be greatly appreciated.
Ken Slovak - said:
I don't see a Delete method in the Object Browser for Outlook 2007 for
Views (or in earlier versions of Outlook either). At least here it's the
Remove method. If you're not sure about a method, property or event use
the Object Browser.
Fidget Brain said:
i have created a custom MAPIFolder and would like to remove some of the
default views. I get a COM exception when I try this. Is this a bug in
the Beta code or is it just not possible?
here is my code:
Outlook.Folder contactsFolder = (Outlook.Folder)
this.Application.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Outlook.Folder myFolder = (Outlook.Folder)
contactsFolder.Add("MyFolder", System.Reflection.Missing.Value);
myFolder.Views["By Location"].Delete();