Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Remove Standard View in Outlook 2007?

Geek News

Remove Standard View in Outlook 2007?
"Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> 7/6/2006 4:53:54 AM
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();


Re: Remove Standard View in Outlook 2007?
"Sue Mosher [MVP-Outlook]" <suemvp[ at ]outlookcode.com> 7/6/2006 11:11:21 AM
It is not possible to remove any of the standard views in any version of Outlook. What about setting Folder.CustomViewsOnly = True instead?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> wrote in message news:OI8xngLoGHA.4628[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
>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();
>
>
Re: Remove Standard View in Outlook 2007?
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 7/6/2006 1:59:29 PM
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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> wrote in message
news:OI8xngLoGHA.4628[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
>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();
>

Re: Remove Standard View in Outlook 2007?
"Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> 7/6/2006 11:17:47 PM
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 - [MVP - Outlook]" <kenslovak[ at ]mvps.org> wrote in message
news:%23zqLsRQoGHA.1656[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
>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.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> wrote in message
> news:OI8xngLoGHA.4628[ at ]TK2MSFTNGP05.phx.gbl...
>>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();
>>
>


Re: Remove Standard View in Outlook 2007?
"Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> 7/6/2006 11:34:54 PM
sue

many thanks. the answer was right in front of me all this time. so sorry to
have wasted you time.

"Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> wrote in message
news:ezv$eJVoGHA.4424[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
> 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 - [MVP - Outlook]" <kenslovak[ at ]mvps.org> wrote in message
> news:%23zqLsRQoGHA.1656[ at ]TK2MSFTNGP03.phx.gbl...
>>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.
>>
>> --
>> Ken Slovak
>> [MVP - Outlook]
>> http://www.slovaktech.com
>> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
>> Reminder Manager, Extended Reminders, Attachment Options
>> http://www.slovaktech.com/products.htm
>>
>>
>> "Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> wrote in message
>> news:OI8xngLoGHA.4628[ at ]TK2MSFTNGP05.phx.gbl...
>>>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();
>>>
>>
>
>


Re: Remove Standard View in Outlook 2007?
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 7/7/2006 1:34:08 PM
Standard views can't be deleted using the Outlook object model, as Sue
pointed out and I missed. You can hack things using hidden messages but I'd
expect the standard views to be re-created if a switch like /cleanviews was
used to start Outlook.

I don't see any Delete method there in the Object Browser for the Views
collection. A View object has a Delete method but as far as I can see the
Views collection only has a Remove method.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Fidget Brain" <no.spam[ at ]martinthrelly[ at ]yahoo.com> wrote in message
news:ezv$eJVoGHA.4424[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
> 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.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net