Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Events.SourceWithType

Returns the first source matching the type.

Component Version macOS Windows Linux Server iOS SDK
Events 6.2 ✅ Yes ❌ No ❌ No ❌ No ✅ Yes
MBS( "Events.SourceWithType"; Type { ; AsJSON } )   More

Parameters

Parameter Description Example Flags
Type The type of source.
Can be Birthdays, Local, MobileMe, Exchange, CalDAV or Subscribed.
"Local"
AsJSON Pass 1 to return result as JSON. Optional

Added in version 13.4.

Result

Returns source identifier, empty or error.

Description

Returns the first source matching the type.
This is a convenient way to find local or iCloud source.

Examples

Query local source:

MBS( "Events.SourceWithType"; "Local" )

Find a source for a new calendar:

# We need a source to add the new calendar to. I prefer local, but newer macOS doesn't have it, so we use caldav for iCloud
Set Variable [ $source ; Value: MBS( "Events.SourceWithType"; "local" ) ]
If [ IsEmpty ( $source ) ]
    Set Variable [ $source ; Value: MBS( "Events.SourceWithType"; "caldav" ) ]
End If

Query as JSON:

MBS( "Events.SourceWithType"; "CalDAV"; 1 )

Example result:
{ "sourceTypeText" : "CalDAV", "title" : "Mac.com", "sourceIdentifier" : "68B72E23-6DC9-47EC-9C29-D844DB9F77BD", "isDelegate" : false, "sourceType" : 2 }

See also

Release notes

Example Databases

Blog Entries

This function is free to use.

Created 24th March 2016, last changed 20th July 2023


Events.Source.Type - Events.Sources