Outlook

From miki
Jump to navigation Jump to search

Links

Miscellaneous

  • Summary of keyboard shortcuts can be found here.
Shortcut Description Custom
C-q Mark as read
C-S-v Move message

References

Important Registry Keys

Apparently important registry keys are under:

[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook]
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles]
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook]

Unlocking

Account Settings

To unlock access to Account Settings (error "This feature has been disabled by your system administrator"), the following registry key must be set to 0 (for Outlook 2003/2007):

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Setup]
"ModifyAccounts"=dword:00000000

Cached Exchange Mode

The following keys were set in my configuration, preventing to change the settings related to Cached Exchange Mode. In particular the mode selection was disabled, ie. the options Download full items, Download headers and then full items, Download headers were all grayed out.

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Cached Mode]
"CachedExchangeMode"=dword:00000001
"Enable"=dword:00000001
"NoDrizzle"=dword:00000001
"NoFullItems"=dword:00000001
"NoHeaders"=dword:00000000
"NoManualOnlineSync"=dword:00000001
"SyncPFFav"=dword:00000001

To unlock all settings, and eg. allow download full headers, simply delete values CachedExchangeMode, NoDrizzle, NoFullItems, NoHeaders, and NoManualOnlineSync (ie. all but Enable and SyncPFFav).

Move .pst to another location

Outlook 2007

Follow the simple procedure described here:

  1. Open Outlook - Configure your GMail account as detailed here. Stop Outlook.
  2. Open Control Panel → Choose Mails → Click on Data files.
  3. Select the Account name and check for the location of the PST file. Leave the window open.
  4. Open the folder containing the PST. Move the PST to the desired location.
  5. Do NOT rename the file - if you do Outlook creates a new file in the default location again.
  6. Switch to the Data Files window (as opened in Step 2) and double click on the PST file location.
  7. Outlook displays an error window, Ignore the error, and point to the new location. Close the windows.
  8. Outlook may create a new PST in the default location again, delete it, in such a case.
  9. Restart Outlook.
Outlook 2010

Inspired from instructions at [2].

To move the .OST file,

  1. Close Outlook, and move .OST file to desired location
  2. Open Outlook Data File Settings dialog (Control Panel → MailData Files... → select exchange account → Settings...Advanced...Outlook Data File Settings)
  3. Click Disable Offline Use, and then click Yes.
  4. Click Browse, and select the .OST file at the new location, and click Open.

If Disable Offline Use is grayed out, you first need to disable the Cached Exchange Mode. For this,

  1. Open the Advanced pane in Microsoft Exchange account dialog (Control Panel → MailData Files... → select exchange account → Settings...Advanced...).
  2. Uncheck the box Use Cached Exchange Mode, and click Apply.
  3. Don't forget to restore the Cached Exchange Mode afterwards.

Group policies might prevent disabling the cached exchange mode. In that case, you need to temporarily disable the policy.

  1. Open regedit, and go to key HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\14.0\Outlook\cached mode
  2. First export the key (File → export...), then delete the key to remove the policy.
  3. When .OST file is moved and cache Exchange Mode is restored, restore the policy by importing the .reg file generated during the previous step.

Note that by removing the policy this way, the Use Cached Exchange Mode box might already be cleared although the cached mode is still applied. In that case, just select the box, apply, and clear the box again.

Outlook 2013 / 365

Yet another trick is needed. This time we need to create a new outlook profile [3], []

  1. Copy your .ost file to the new location. You can skip this step if you want to create a new .ost file.
  2. Open the Control panel, find Mail.
  3. Click Show Profiles
  4. Click Add
  5. Type a name for your new profile, click OK
  6. Enter your username and password and let Outlook find your account information
  7. Select the Change account settings option, and then click Next
  8. Click More Settings.
  9. On the Advanced tab, click Outlook Data File Settings.
  10. Click Browse, browse to the .ost file that you copied in step 1, and then click Open.
  11. If you want to create a new .ost file, browse to the new location, enter a filename, and then click Open. Outlook will create the new .ost file.
  12. OK your way back to the Mail profile dialog.
  13. Click Always use this profile, select the new profile that you created, and then click OK to close the dialog.

Macro

Installation

To install a macro:

  • Alt-F11 in Outlook
  • Open Project1Microsoft Office Outlook Objectsdouble-click ThisOutlookSession
  • copy/paste code
  • close & save

If required, change the macro security settings:

  • Tools → Macro → Security → Macro Security → Warning for all macros (You'll have an annoying popup at startup)
  • Tools → Macro → Security → Macro Security → No security check for macros (no pop-up but since you'll always click yes anyway...)

In Outlook 2016:

  • File → Options → Trust Center → Trust Center Settings → ...

Send & Save

Reference: [4]

Lotus Notes can prompt the sender to specify what folder a message should be saved in. In Outlook, you can set the storage folder on the Options dialog. This VBA code reproduces something closer to the Notes behavior by popping up the Select Folder dialog when the user sends the message. (see here and there)
UPDATE: Avoid treating appointments as it fails.

Private Sub Application_ItemSend(ByVal Item As Object, _
    Cancel As Boolean)
  Dim objNS As NameSpace
  Dim objFolder As MAPIFolder
  Set objNS = Application.GetNamespace("MAPI")
  If TypeOf Item Is MailItem Then
    Set objFolder = objNS.PickFolder
    If TypeName(objFolder) <> "Nothing" Then
         Set Item.SaveSentMessageFolder = objFolder
    End If
  End If
  Set objFolder = Nothing
  Set objNS = Nothing
End Sub

Install instruction (Outlook 2007):

  • Press Alt-F11 to open MS Visual Basic.
  • Locate on the left pane Project1 (VbaProject.OTM) → Microsoft Office Outlook Objects → ThisOutlookSession. Double click on ThisOutlookSession
  • Paste the code above, and close MS Visual Basic.
  • Close and restart Outlook (you might want to change your macro policy)

If you don't want this pop-up all the time but to sort on casual base, you can use the built-in option:

  • While writing a new mail, select "Options" tab (not the "Options" toolbar) -> "Save Sent Item" button -> Other Folder -> Select

Set Show Total Item Count for all folders recursively

  1. Press Alt-F11 to open VBA in Outlook.
  2. Click Insert > Module, and paste code below.
  3. Press F5 and select the macro below.
Sub ShowTotalInAllFolders()
Dim oStore As Outlook.Store
Dim oRoot As Outlook.Folder

On Error Resume Next

For Each oStore In Application.Session.Stores
Set oRoot = oStore.GetRootFolder
ShowTotalInFolders oRoot
Next
End Sub

Private Sub ShowTotalInFolders(ByVal Root As Outlook.Folder)
Dim oFolder As Outlook.Folder

On Error Resume Next

If Root.Folders.Count > 0 Then
For Each oFolder In Root.Folders
oFolder.ShowItemCount = olShowTotalItemCount
ShowTotalInFolders oFolder
Next
End If
End Sub

To compare with the content of an IMAP server Maildir, we have the oneliner:

find Maildir -type d -name cur | while read F; do echo "$(($(ls -l "$F" | wc -l) - 1 ))  -- $F"; done | sort -k 3 | column -t

Export contacts to .VCF files

'==========================================================
'==     VB Script to Export Outlook Contacts to vCard (vcf) files
'==
'==           Copyright © 2008, Dave Moats
'==
'== This sample is provided 'AS-IS', without any
'== express or implied warranty. In no event will the
'== authors be held liable for any damages arising from
'== the use of this sample code.
'==
'== Permission is granted to anyone to use this sample
'== code for any purpose, including commercial applications,
'== subject to the following restrictions:
'==
'== The origin of this code must not be misrepresented;
'== you must not claim that you wrote the original code.
'==
'== If you use this code, an acknowledgment in the
'== documentation is requested - shown below:
'==
'==             Portions Copyright © 2008,
'==        Dave Moats (http://www.davemoats.com/).
'==
'==========================================================

'==========================================================
'== NOTE: watch for wrapped lines and html special
'==        characters in the web representation of this
'==        sample code
'==========================================================

'==========================================================
'==
'== exportContacts.vbs - a script used to export contacts
'==                        from outlook and save them in
'==                        vcf format
'==========================================================
option explicit

'==========================================================
'== declare the local variables to be used
'==========================================================
dim scriptName, namedArgs, folderPath

'==========================================================
'== get the name of the running script
'==========================================================
scriptName = wscript.scriptname

'==========================================================
'== get the named command line arguments
'==========================================================
set namedArgs = wscript.arguments.named

if not namedArgs.exists("p") then
   wscript.echo "Usage: " & scriptName & " /p:<output folder path> is required"
   wscript.echo "Example: cscript " & scriptName & " /p:c:\path to the folder"
   wscript.quit
else
   folderPath = namedArgs.item("p")
end if

set namedArgs = nothing

'==========================================================
'== now call the subroutine that does all the work
'==========================================================
exportToVCF folderPath, ".vcf"

wscript.quit

'==========================================================
'== sub exportToVCF - subroutine that connects to outlook
'==                   and exports all contacts to the path
'==                   specified in the exportPath argument
'==========================================================
sub exportToVCF(exportPath, ext)
   
    '======================================================
    '== declare the local variables
    '======================================================
    dim outApp, fldContacts, contactEntry, exp

    '======================================================
    '== create the outlook object and then get the contacts
    '======================================================
    set outApp = createobject("Outlook.Application")


    '======================================================
    '== FIXME : put fold and subfolder structure here
    '======================================================
    set fldContacts = outApp.getnamespace("MAPI").folders("Personal Folders").folders("Sync2Mobile")

    '======================================================
    '== here we are looping the entries in the contacts
    '== folder looking for contacts - when a contact is
    '== found it will be exported
    '======================================================
    for each contactEntry in fldContacts.items

       if typename(contactEntry) = "ContactItem" then

          dim tmpString, tmpArr, periodLocation, outPath

          tmpString = contactEntry.FileAs
         
          '================================================
          '== creating the name of the vcf file based on
          '== the first and last name fields of the contact
          '================================================
          tmpString = replace( tmpString, "'", "" )
          tmpString = replace( tmpString, "<", "" )
          tmpString = replace( tmpString, ">", "" )
          tmpString = replace( tmpString, ":", "" )
          tmpString = replace( tmpString, """", "" )
          tmpString = replace( tmpString, "/", "" )
          tmpString = replace( tmpString, "\", "" )
          tmpString = replace( tmpString, "|", "" )
          tmpString = replace( tmpString, "?", "" )
          tmpString = replace( tmpString, "*", "" )

          tmpArr = split( tmpString, "," )

          if ubound( tmpArr ) <> 1 then
             wscript.echo tmpString & ext
             outPath = exportPath & "\" & tmpString & ext
          else
             if tmpArr(0) = "com" then
                wscript.echo trim(tmpArr(1)) & trim(tmpArr(0)) & ext
                outPath = exportPath & "\" & trim(tmpArr(1)) & trim(tmpArr(0)) & ext
             else
                wscript.echo trim(tmpArr(1)) & " " & trim(tmpArr(0)) & ext
                outPath = exportPath & "\" & trim(tmpArr(1)) & " " & trim(tmpArr(0)) & ext
             end if
          end if
         
          contactEntry.saveas outPath, 6

       end if
    next
   
    '======================================================
    '== dumping the object references that were created
    '======================================================
    set fldContacts = nothing
    set outApp = nothing

end sub

Troubleshooting

Empty encrypted mails

UPDATE — See my new script decryptmaildir.sh. Modified by Phil Teuwen to use the excellent mail parsing utility formail (from procmail package).


Sometimes Outlook encrypted mails saved to an IMAP folder can appear empty. This can be fixed by editing the mail raw content as indicated below.

Incorrect mail format:
From: "ABC" <abc@serv.com>
To: "ABC" <abc@serv.com>
Subject: Hello World 
Date: Tue, 22 Oct 2013 11:01:19 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----=_NextPart_000_0458_01CECF1E.6FCF53F0"
X-Mailer: Microsoft Outlook 14.0
Content-Language: en-us

This is a multipart message in MIME format.

------=_NextPart_000_0458_01CECF1E.6FCF53F0
Content-Type: text/plain;
	name="smime.p7m"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="smime.p7m"


------=_NextPart_000_0458_01CECF1E.6FCF53F0
Content-Type: application/pkcs7-mime;
	name="smime.p7m"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="smime.p7m"

MIAGCSqGSIb3DQEHA6CAMIACAQAxgg4qMIH2AgEAMF8wUTETMBEGCgmSJomT8ixkARkWA2NvbTET
MBEGCgmSJomT8ixkARkWA254cDETMBEGCgmSJomT8ixkARkWA3diaTEQMA4GA1UEAxMHRU1FQS1D

[...]

ISw2YHqPUmKXYrgAAAAAAAAAAAAA

------=_NextPart_000_0458_01CECF1E.6FCF53F0--
Corrected format (deleted, moved)
From: "ABC" <abc@serv.com>
To: "ABC" <abc@serv.com>
Subject: Hello World 
Date: Tue, 22 Oct 2013 11:01:19 +0100
MIME-Version: 1.0
Content-Type: application/pkcs7-mime;
	name="smime.p7m"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="smime.p7m"
X-Mailer: Microsoft Outlook 14.0
Content-Language: en-us

MIAGCSqGSIb3DQEHA6CAMIACAQAxgg4qMIH2AgEAMF8wUTETMBEGCgmSJomT8ixkARkWA2NvbTET
MBEGCgmSJomT8ixkARkWA254cDETMBEGCgmSJomT8ixkARkWA3diaTEQMA4GA1UEAxMHRU1FQS1D

[...]

ISw2YHqPUmKXYrgAAAAAAAAAAAAA

Here a small script to fix mails.

#! /bin/bash

function single() { A=${1%//}; echo ${A%/}/; }

set -u -e                       # Forbid uninitialized vars, exit on error

SRC=$1
DST=$2

if [ -z "$SRC" -o -z "$DST" ]; then
    echo "Usage: $(basename $0) srcfile dstfile"
    exit 1
fi

if [ -a "$DST" -a -d "$DST" ]; then
    DST=$(single $DST)$(basename $SRC)
fi

touch "$DST" || { echo "Can't write to $DST"; exit 1; }

# BOUNDARY=$(perl -lne 'print for /boundary="(----=.*)"/g' $SRC)

sed -rn "1,/^MIME-Version/p" "$SRC" > "$DST"
cat <<__EOF__ >> "$DST"
Content-Type: application/pkcs7-mime;
	name="smime.p7m"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="smime.p7m"
__EOF__
sed -rn "/^X-Mailer/,/^$/p" "$SRC" >> "$DST"
sed -rn '/^[A-Za-Z0-9+\/=]{64}/,/^$/{/^$/!p}' "$SRC" >> "$DST"

Outlook 2010 removes + from mobile numbers

The fix is to configure dialing rules (in Control PanelPhone and Modem), so that outlook accepts pluses ('+') in phone numbers (from [6]).

Disable Windows Search

See technet.microsoft.com. This fixes the following messages:

Something went wrong and your search couldn’t be completed.
Search results may be incomplete because items are still being indexed.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
"PreventIndexingOutlook"=dword:00000001

Fix online status not showing in Outlook

If the online status of contacts are no longer showing in Outlook, make sure that the IM Provider is correctly set in registry [7]:

HKEY_CURRENT_USER\Software\IM Providers]
"DefaultIMApp"="Lync"

Configure IMAP account on Office 365

In some configuration, the settings are not available in Office 365.

To configure the IMAP accounts:

  • Open Control Panel.
  • In search box, search for mail.
  • Control Panel must return an entry called Mail (Microsoft Outlook) (32-bit).

Outlook Tips of the Week

Some tips to propose for the Outlook Tips of the Week:

  • Adapting size of picture in Outlook (tryp with .bmp / .png)
  • Check link from RMe [8]
  • Udate save sent macro to also cope with appointment
  • Archive macro from Thierry
  • Move to folder context-menu and button
  • Add PST tasks to To-Do List
Right click on the personal folder file in Outlook, → properties, then select option "add this folder task & follow-up to To-Do List machin brol"
  • Create auto filtering rule from mail
  • Move to folder → in folder view, can type the name of folder to quick find (then ENTER)
  • Check Yobi for more tips
  • Disable CTRL-Enter shortcut for send mail (in File → Options).

Use Tighter Spacing

  • In View > Layout > Use Tighter Spacing, to show more messages in the message pane.