Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3    Statistic  

Events.requestAccessToEntityType

Requests access for the entity type.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Events 6.2 Yes No Yes, macOS only No No

MBS( "Events.requestAccessToEntityType"; Type )

Parameters

Parameter Description Example value
Type Which entity type you like to request: Event or Reminder. "Event"

Result

Returns Wait, OK or error.

Description

Requests access for the entity type.
Users are able to grant or deny access to event and reminder data on a per-app basis. To request access to event and/or reminder data, call Events.requestAccessToEntityType. This will not block the app while the user is being asked to grant or deny access.
Until access has been granted for an entity type, the event store will not contain any calendars for that entity type, and any attempt to save will fail. The user will only be prompted the first time access is requested; any subsequent instantiations of EKEventStore will use the existing permissions.

You can later check status with Events.AuthorizationStatusForEntityType.
The function may return OK if access is granted directly or Wait if user will be asked.

Examples

Request access for reminder:

MBS( "Events.requestAccessToEntityType"; "Reminder" )

Query authorization:

Set Variable [$r; Value:MBS("Events.AuthorizationStatusForEntityType"; "Reminder")]
If [MBS("IsError")]
    Show Custom Dialog ["We have a problem"; MBS("Text.RemovePrefix"; $r; "[MBS] ")]
Else If [$r = "NotDetermined"]
    Set Variable [$r; Value:MBS( "Events.requestAccessToEntityType"; "Reminder" )]
    If [$r = "Wait"]
        #dialog is showing.
    Else If [$r = "OK"]
        Show Custom Dialog ["Success"; "We are authorized and ready to go."]
    Else
        Show Custom Dialog ["We have a problem"; $r]
    End If
Else If [$r = "Restricted"]
    Show Custom Dialog ["Success"; "We are authorized for a restricted access and ready to go."]
Else If [$r = "Denied"]
    Show Custom Dialog ["Problem"; "We are denied for calendar access. Please go to system preferences and enable us."]
Else If [$r = "Authorized"]
    Show Custom Dialog ["Success"; "We are authorized and ready to go."]
Else
    Show Custom Dialog ["We have a problem"; $r]
End If

See also

Example Databases


Events.defaultCalendarForNewReminders   -   FM.AllowFileDragDrop

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins