How to delete default folder "Contacts" (olFolderContacts) in a .pst file

Status
Not open for further replies.

Nik

Member
Outlook version
Outlook 2007
Email Account
IMAP
Hello,

it is normally no possible to delete the default folder "Contacts" (olFolderContacts) in a .pst file.

Would it be maybe possible to delete via VBA and how?
I tried via VBA macro but the folder can't be delete:

Code:
Sub DeleteFolder()
    Dim olApp       As Outlook.Application
    Dim olNamespace As Outlook.NameSpace
    Dim olFolder    As Outlook.MAPIFolder
   
    Set olApp = New Outlook.Application
    Set olNamespace = olApp.GetNamespace("MAPI")
    'Set olFolder = olNamespace.Session.folders("2. Archiv_Gelöschte Objekte").folders("Contacts")
    Set olFolder = olNamespace.Session.folders("nikolay@chervenkov.de_Lokal").folders(olFolderContacts)
   
    If msgbox("Soll der Ordner gelöscht werden?", vbYesNo + vbQuestion, "Löschen?") = vbYes Then
              olFolder.Delete
              msgbox "Ordner wurde gelöscht", 64, "Hinweis"
    End If

End Sub
But any other methods are welcome.

Thanks!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It's possible to delete the default folders using a macro, but if the data file is set as default, it will be recreated. Hiding is generally a little better, but the default folders are occasionally unhidden by outlook, especially if in an exchange mailbox.

if the data file is not set as default, you can delete the default folders using a macro and they won't return unless you set it as default.

this article has the macro code that can do it How to Hide or Delete Outlook's Default Folders
 

Nik

Member
Outlook version
Outlook 2007
Email Account
IMAP
Diana thank you very much. Excellent!

PS:
> if the data file is not set as default, you can delete the default folders using a macro and they won't return unless you set it as default.

After I have set another .pst as default it was not possible to delete "Contacts".

I have to use first your macro to insert first the property "PR_ATTR_HIDDEN, PidTagAttributeHidden, ptagAttrHidden" becouse in MFCMAPI I didn't have "Quick Step Settings" folder to select and to copy "PR_ATTR_HIDDEN, PidTagAttributeHidden, ptagAttrHidden" entry: The Method via Copy&Paste in MFCMAPI was not possible.

But if I know now the all data of this property "PR_ATTR_HIDDEN" is it possible to insert all this data in in MFCMAPI manually without to use a external macro?

Code:
Tag: 0x10F4000B

Type: PT_BOOLEAN

Property Name: PR_ATTR_HIDDEN

Other Names: PidTagAttributeHidden, ptagAttrHidden

DASL: http://schemas.microsoft.com/mapi/proptag/0x10F4000B
After Copy and Paste you will show:
Code:
Enter interface for destination and set flags Flags:

0x00000001 MAPI_MOVE

0x00000002 MAPI_NOREPLACE

0x00000004 MAPI_DECLINE_OK

0x00000008 MAPI_DIALOG

Interfaces (abbreviated list)

{00020303-0000-0000-C000-000000000046} IID_IMAPIProp

{00020307-0000-0000-C000-000000000046} IID_IMessage

{0002030B-0000-0000-C000-000000000046} IID_IMAPIContainer

{0002030C-0000-0000-C000-000000000046} IID_IMAPIFolder


Interface

{00020303-0000-0000-C000-000000000046} = IID_IMAPIProp


Flags

0x00000008
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You can set the property using mfcmapi - if you don't have the folder I mentioned, there are other hidden folders - any folder you see in mfcmapi but not in outlook has the flag.

if the data file is not your default folder, you can delete the folder using mfcmapi (it can't be deleted from the outlook interface even if no longer default - outlook sets a property marking it as a default - i don't recall which property tho).
 

Nik

Member
Outlook version
Outlook 2007
Email Account
IMAP
it was possible to hide the default "Contacts" folder via your macro (and after that via MFCMAPI) without problem.
The entry "PR_ATTR_HIDDEN..." was not in any folder.

> any folder you see in mfcmapi but not in outlook has the flag

hmm ... I've been looking for a long time and can not find anything. Only after run the macro I have get the entry "PR_ATTR_HIDDEN..."

Is it not possible to insert a entry manually in MFCMAPI? Only Past&Copy?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You can type it in, copy and paste removes any problem of mistyping and is a lot faster for the average user.

I'll have to boot up an outlook 2007 machine - there are folders in it marked hidden but I don't recall offhand which ones are in 2007.
 

Nik

Member
Outlook version
Outlook 2007
Email Account
IMAP
Hello Diane!

Everything is OK! It does not matter.

I just wrote it as a hint for other users.

In my .pst-storage file it was work first via the macro (to get this property "PR_ATTR_HIDDEN...").

Then purely from interest I have searched for a way how this data can be entered manually inside of MFCMAPI Tool, but could find no way.


Thank you very much for your great support and excellent documentation!


Greetings

Nik
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Wow, Outlook 2007 (at least with a pst) doesn't have any hidden folders within the personal store folders.

This video shows how to do it - just just need the property value from the end of the URL - 0x10F4000B and Outlook will do the rest for you.
 

Nik

Member
Outlook version
Outlook 2007
Email Account
IMAP
o, yes … all right!
Now I know in the feature how to put a new property in MFCMAPI directly.
Perfect.

Thank you a lot Diana!
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
C Delete Subject-Add Organizer to all Reservations in Default Calendar. Using Outlook 0
B Outlook 2016: Can't delete default calendar but I don't use it Using Outlook 7
S How to delete "Outlook Default Profile" via script Outlook 2010 Using Outlook 3
J To delete the draft email Using Outlook 2
W Recurrence: delete older occurrences / change earliest start time Outlook VBA and Custom Forms 0
J Moved many emails to Outlook external folder, need to delete on Gmail server Using Outlook 14
A Attachments.Delete Outlook VBA and Custom Forms 3
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
R Expand VBA Permanent Delete Code Outlook VBA and Custom Forms 6
M Delete headers in Inline reply Outlook VBA and Custom Forms 5
N VBA to delete duplicates by message-id on common pst for 2 or more emails Outlook VBA and Custom Forms 0
S How can I delete all copies of a given companies logo graphic from all my emails at once? Using Outlook 3
9 Outlook 2016 How to save an Outlook attachment to a specific folder then delete the email it came from? Using Outlook 1
D after delete mail, open the next one Outlook VBA and Custom Forms 0
O Delete duplicate emails - subscription notifications Using Outlook 5
F Delete/create/reset Exchange mailbox on Outlook.com Using Outlook.com accounts in Outlook 3
L Email Read and Delete Outlook VBA and Custom Forms 4
H Delete Calendar Entries in Using Outlook 2
D Delete Emails from Senders in Shared Mailbox Outlook VBA and Custom Forms 1
R How to delete Facebook Contacts folder in Outlook 365 Using Outlook 7
R VBA Code to permanently delete selected email Outlook VBA and Custom Forms 10
JoeG Appointment Delete/Change Recurrence Outlook VBA and Custom Forms 0
C Outlook 2016 cannot delete, email showing in root Exchange Server Administration 5
C How to replace or delete first instance of sentence in mail body? Outlook VBA and Custom Forms 1
Z Can't delete IMAP folder Using Outlook 2
J Delete old emails Exchange Server Administration 1
undercover_smother Automatically Forward All Sent Mail and Delete After Send Outlook VBA and Custom Forms 10
T Delete Emails from search results Outlook VBA and Custom Forms 1
I Outlook 2013 How do I delete a Calendar? Using Outlook.com accounts in Outlook 1
O How to delete posts New Slipstick.com Articles 1
B How to 'really' delete IMAP emails? Using Outlook 6
H Search and delete part of a link inside HTML body message Outlook VBA and Custom Forms 2
B Delete/replace old files and save new attachments Using Outlook 1
D Delete selected text from incoming emails Outlook VBA and Custom Forms 25
mikolajek Random message selected after hard delete Using Outlook 4
Jeanne Goodman Delete Calendar Item Bypassing Deleted Items folder Outlook VBA and Custom Forms 2
P Delete mail macro Outlook VBA and Custom Forms 6
O How to delete duplicate RSS messages? Using Outlook 6
J "This item has been changed still want to delete it" message Using Outlook 3
M Can't Delete iCloud Calendar Notifications From Outlook 2016 Using Outlook 0
P Delete Icon Using Outlook 2
makinmyway Bulk Delete Contacts in iOS Outlook App Using Outlook 4
Diane Poremsky Delete an Outlook Group New Slipstick.com Articles 0
M Cannot Delete Emails from IMAP inbox Using Outlook 4
K Deleted calendar and contact items not going to delete folder Using Outlook 1
K Outlook 2013 Deleted calendar and contact items not going to delete folder Exchange Server Administration 1
J Adding Reply & Delete to main toolbar? Using Outlook 0
Reji Rajan Delete Data Outlook VBA and Custom Forms 1
K check for sender, follow to my personal adress and delete the sent folder. Outlook VBA and Custom Forms 1
L Outlook 2007 Delete Email Addresses Using Outlook 19
Similar threads


















































Top