change default view to be NOT 'show in groups'
-
- Panoramic Lounger
- Posts: 8381
- Joined: 25 Jan 2010, 09:09
- Location: retirement
change default view to be NOT 'show in groups'
Outlook 2007 hit our office today...
All my mailboxes are displayed in 'groups' like Date: Last Week and Date: Yesterday and Date: Today. At the moment I'm right clicking on the column headers and clicking 'Arrange By' and unticking 'Show in Groups' but that only applies to the mailbox I'm in and I have to do it again when I move to another mailbox. I have lots of mailboxes. Is there not a untick once / apply to all mailboxes option somewhere?
Ken
All my mailboxes are displayed in 'groups' like Date: Last Week and Date: Yesterday and Date: Today. At the moment I'm right clicking on the column headers and clicking 'Arrange By' and unticking 'Show in Groups' but that only applies to the mailbox I'm in and I have to do it again when I move to another mailbox. I have lots of mailboxes. Is there not a untick once / apply to all mailboxes option somewhere?
Ken
-
- Administrator
- Posts: 79287
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- Panoramic Lounger
- Posts: 8381
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: change default view to be NOT 'show in groups'
Thanks, not sure I'm brave enough (yet) to start messing with the registry. I think I'll have to wait a few days until the dust has settled a bit more and our IT people are more likely to forgive me if something goes wrong.
Ken
Ken
-
- 3StarLounger
- Posts: 397
- Joined: 24 Jan 2010, 19:43
- Location: Salt Lake City, Utah, USA
Re: change default view to be NOT 'show in groups'
EDITED - I overlooked that TWO functions AND a sub are called. Run the SetNoGroupViews sub.
You could give this code a whirl:
You will need to run it on each information store (Exchange mailbox, other mailbox, each PST).
Acknowledging my use of Jefferson Scher's coding of the Outlook XML View Table Schema.
You could give this code a whirl:
Code: Select all
Public colFolders As Collection
Public Function AllFoldersCollection(ByVal objRootFolder As MAPIFolder)
Set colFolders = New Collection
Call GetFoldersCollection(objRootFolder)
End Function
Private Function GetFoldersCollection(ByVal objStartFolder As MAPIFolder)
Dim lngC As Long
colFolders.Add Item:=objStartFolder, Key:="\" & objStartFolder.FolderPath
For lngC = 1 To objStartFolder.Folders.Count
colFolders.Add Item:=objStartFolder.Folders(lngC), _
Key:=objStartFolder.Folders(lngC).FolderPath
Debug.Print objStartFolder.Folders(lngC).FolderPath
If objStartFolder.Folders(lngC).Folders.Count > 0 Then _
Call GetFoldersCollection(objStartFolder.Folders(lngC)) 'recurse this function to subfolders
Next lngC
End Function
Sub SetNoGroupViews()
Dim fldrSel As MAPIFolder
Dim allSubFolders As New Collection
Dim lngC As Long
Set fldrSel = Application.GetNamespace("MAPI").PickFolder
If Not fldrSel Is Nothing Then
Call AllFoldersCollection(fldrSel)
Set allSubFolders = colFolders
For lngC = 1 To allSubFolders.Count
If allSubFolders(lngC).DefaultItemType = olMailItem Then _
Call SetTableProperties(allSubFolders(lngC), "Messages", "view/arrangement/autogroup", "0")
Next lngC
End If
Set allSubFolders = Nothing
Set fldrSel = Nothing
MsgBox "Done"
End Sub
Sub SetTableProperties(ByRef fdrFolder As MAPIFolder, ByVal strViewName As String, _
ByVal strProp As String, ByVal strValue As String)
'Jefferson Scher
'Set a reference to the MSXML 2.6 type library.
Dim objViews As Views
Dim objView As View
Dim objXML As New MSXML2.DOMDocument
Dim objXMLNode As MSXML2.IXMLDOMNode
Set objViews = fdrFolder.Views
Set objView = objViews(strViewName)
'Load the schema into the MSXML parser.
objXML.loadXML bstrXML:=objView.XML
'Select the node you want to modify and assign the new value.
Set objXMLNode = objXML.selectSingleNode(querystring:=strProp)
objXMLNode.nodeTypedValue = strValue
'Copy the modified XML back to the new view.
objView.XML = objXML.XML
'Save and apply the new view.
objView.Save
objView.Apply
End Sub
Acknowledging my use of Jefferson Scher's coding of the Outlook XML View Table Schema.
Last edited by Goshute on 02 Sep 2010, 15:59, edited 4 times in total.
Goshute
I float in liquid gardens
I float in liquid gardens
-
- Administrator
- Posts: 12758
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: change default view to be NOT 'show in groups'
I just tried this on Outlook 2010 and, sadly, it doesn't work.Goshute wrote:...
You could give this code a whirl:
...
- The variable colFolders is not defined
- There doesn't seem to be a SetTableProperties function.
StuartR
-
- 3StarLounger
- Posts: 397
- Joined: 24 Jan 2010, 19:43
- Location: Salt Lake City, Utah, USA
Re: change default view to be NOT 'show in groups'
Oops, need to Type this public variable:
Public colFolders As Collection
Public colFolders As Collection
Goshute
I float in liquid gardens
I float in liquid gardens
-
- Administrator
- Posts: 12758
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: change default view to be NOT 'show in groups'
I guessed this one, but it still complains about SetTableProperties - Compile error: Sub or Function not defined.Goshute wrote:Oops, need to Type this public variable:
Public colFolders As Collection
StuartR
-
- 3StarLounger
- Posts: 397
- Joined: 24 Jan 2010, 19:43
- Location: Salt Lake City, Utah, USA
Re: change default view to be NOT 'show in groups'
Sorry - this is sufficiently old that I had forgotten which were called subs and procedures, and which were built in Outlook Methods. I have edited the earlier post to correct this.
In fact I'd be wary of using the code above, first run the code in this post. I'm not sure of the extent to which Outlook 2010 has revised the View table schema. Before running the revised code above, see if this runs first, and see if the schema still includes, among other things
Here's the code, examine the results in the Intermediates window:
In fact I'd be wary of using the code above, first run the code in this post. I'm not sure of the extent to which Outlook 2010 has revised the View table schema. Before running the revised code above, see if this runs first, and see if the schema still includes, among other things
Code: Select all
<view type="table">
<viewname>Messages</viewname>
....
<arrangement>
<autogroup>0</autogroup>
...
Code: Select all
Sub GetTableViews()
' Jefferson Scher
Dim objViews As Views
Dim strViewName As String, strViewXML As String
Set objViews = Application.GetNamespace("MAPI").PickFolder.Views
strViewName = "Messages"
strViewXML = objViews(strViewName).XML & vbLf & "- - - - - - - - - - - - - - - - - - - - - - - - - -"
Debug.Print strViewXML
Set objViews = Nothing
End Sub
Goshute
I float in liquid gardens
I float in liquid gardens
-
- 3StarLounger
- Posts: 397
- Joined: 24 Jan 2010, 19:43
- Location: Salt Lake City, Utah, USA
Re: change default view to be NOT 'show in groups'
By the way Stuart, you were one of the beneficiaries of this work in the distant past.
Goshute
I float in liquid gardens
I float in liquid gardens
-
- Administrator
- Posts: 12758
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: change default view to be NOT 'show in groups'
I remember, and I want it back.Goshute wrote:By the way Stuart, you were one of the beneficiaries of this work in the distant past.
Thank you.
StuartR
-
- Administrator
- Posts: 12758
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: change default view to be NOT 'show in groups'
When I run this code
I get the error "Object variable or With block variable not set" at the line
strViewXML = objViews(strViewName).XML & vbLf & "- - - - - - - - - - - - - - - - - - - - - - - - - -"
Code: Select all
Sub GetTableViews()
' Jefferson Scher
Dim objViews As Views
Dim strViewName As String, strViewXML As String
Set objViews = Application.GetNamespace("MAPI").PickFolder.Views
strViewName = "Messages"
strViewXML = objViews(strViewName).XML & vbLf & "- - - - - - - - - - - - - - - - - - - - - - - - - -"
Debug.Print strViewXML
Set objViews = Nothing
End Sub
strViewXML = objViews(strViewName).XML & vbLf & "- - - - - - - - - - - - - - - - - - - - - - - - - -"
StuartR
-
- 3StarLounger
- Posts: 397
- Joined: 24 Jan 2010, 19:43
- Location: Salt Lake City, Utah, USA
Re: change default view to be NOT 'show in groups'
Sorry, Stuart, I will need help from someone using Outlook 2010 to go any further with this. (It still works in Outlook 2003 on XP.)
Goshute
I float in liquid gardens
I float in liquid gardens
-
- Administrator
- Posts: 12758
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: change default view to be NOT 'show in groups'
Reviving an ancient thread.
Does anyone have a method (VBA or otherwise) to clear the "Automatically group according to arrangement" flag for all Outlook views?
I tried getting this code to run, but there are too many changes for me to be able to get this going again.
Does anyone have a method (VBA or otherwise) to clear the "Automatically group according to arrangement" flag for all Outlook views?
I tried getting this code to run, but there are too many changes for me to be able to get this going again.
StuartR
-
- Administrator
- Posts: 7262
- Joined: 15 Jan 2010, 22:52
- Location: Middle of England
Re: change default view to be NOT 'show in groups'
Do you have different view settings for different folders? If not, does the Change View > Apply Current View to other folders... not do what you want?
Leif
-
- Administrator
- Posts: 12758
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: change default view to be NOT 'show in groups'
Thank you Leif, that worked perfectly. It did apply ALL view settings to every folder, which meant that I had to change a few things back - for example I wanted sent items to have a different view to other folders - but it was quick and simple.
StuartR