Cannot instantiate VIP object/property out of mail app

Is VIP an object contained in the mail or contacts apps/objects? Or is it just a property somewhere? Or is it an independent object?

Where is the VIP object? Is it still managed in the mail app or is it just hidden because the design is changing at Apple?

The following AppleScript is failing:

tell application "Mail"
	set theVIPs to VIPs

with the error: error "Die Variable „VIPs“ ist nicht definiert." number -2753 from "VIPs" (The variable "VIPs" is not defined.".

In Mail.sdef documentation and in Contacts.sdef documentation I cannot find any documentation of VIP object or VIP property.

Answered by DTS Engineer in 836762022

Looking in the dictionary for Apple Mail I don't see anything named VIP defined. Can you share more information about what you're trying to do?

Adding information: Also this is not working:

tell application "Mail"
				-- VIP mit der E-Mail-Adresse hinzufügen
				--try
				make new VIP with properties {emailAddress:contactEmail}
				--end try

Looking in the dictionary for Apple Mail I don't see anything named VIP defined. Can you share more information about what you're trying to do?

I am trying to write a script which marks all my contacts as VIP. This is the script:

    -- Get all contacts
    set allContacts to every person
    
    repeat with aContact in allContacts
        -- Check on any email address for this contact
        set emailList to emails of aContact
        if (count of emailList) > 0 then
            -- Get first email address of the contac
            set contactEmail to value of item 1 of emailList
            
            -- Set vip flag for that address
            tell application "Mail"
                try
                    make new VIP with properties {emailAddress:contactEmail}
                    -- <HERE IS THE PROBLEM: A VIP OBJECT IS NOT EXISTING>
                end try
            end tell
        end if
    end repeat
end tell

-- Show when ready
display dialog "Alle Kontakte wurden erfolgreich als VIPs in Mail hinzugefügt." buttons {"OK"} default button 1

The problem is in line 14. A VIP object is not existing.

So obviously

  1. Whether I don't have the right understanding on how the VIP flag is working in mail or contacts
  2. Or if VIP is an object, it's not public.

Best, Manuel

VIP is an item related to the Mail "Smart Mailbox" or Contacts "Smart List" constructs, in that it is just something that can be used in a search from which the application can do something like show the results in one of its normal views. While the application can use these results internally, it would need to provide a mechanism for a user to access or use them (or not). As mentioned, if a term (such as a VIP property) is not declared an application's scripting dictionary, the app doesn't provide it, and you can't just make it up.

Mail places the VIP data in the VIPMailboxes.plist (XML) and VIPs.plist (binary property list) files in the ~/Library/Mail/V10 (or whatever version) /MailData folder, where they can be used by the app along with other search terms. It may be possible to edit these files, although you would need to figure out what they are using for the keys and how they are linked to the messages.

Thank you red_menace! I fully agree: it seems to be not described in the dictionary and so not exposed to AppleScript. However, it didn't find any description anywhere at published sites of Apple.

Question to moderators

Can one of the operators give a hint where the VIP implementation architecture or their objects are described? If necessary, I would switch the programming language to one which is able to access these objects. But which language / environment is it?

Comment to manipulating .plist files

I think this is not a good idea because they seem to be just local caches (since the VIP management goes across devices, including iOS and iPadOS). So these objects are not trivial. I can imagine, they are local objects which send messages to the cloud. Anything else doesn't make sense on long term.

Additional critical question to Apple

Why aren't these objects published in the AppleScript dictionary?

It doesn't make sense to have an interface in Apple Mail Rules to be able to call an AppleScript if such a basic object is not exposed. Do you see it differently?

Please file a bug report/enhancement request about VIP not being exposed through the AppleScript interfaces. And after that please post the bug number here. I can also use the escalation path provided by a bug report to ask questions with engineering once your bug report has been assigned to an engineer. I'll check the status and provide an update (if there's anything to report) next time I do a sweep of forums posts where I've suggested bug reports.

Bug Reporting: How and Why? has tips on creating your bug report.

Cannot instantiate VIP object/property out of mail app
 
 
Q