Events.RequestAccessToEntityType
--------------------------------

Requests access for the entity type.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Events](component_Events.md) | [6.2](newinversion62.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "Events.RequestAccessToEntityType"; Type ) 

**MBS**( **"Events.RequestAccessToEntityType";** /\* Requests access for the entity type. \*/  
**$Type**) /\* Which entity type you like to request: Event or Reminder.e.g. "Event" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| 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](EventsAuthorizationStatusForEntityType.md).  
The function may return OK if access is granted directly or Wait if user will be asked.  
  
Please note, that on macOS Sonoma, you may only be allowed to add entries to the calendars unless the user grants full permissions in system preferences.  
### Examples

Request access for reminder:

 Set Variable \[$r ; Value: MBS ( "Events.requestAccessToEntityType"; "Reminder" ) \]  
Query authorization:

 Set Variable \[$r ; Value: MBS ("[Events.AuthorizationStatusForEntityType](EventsAuthorizationStatusForEntityType.md)"; "Reminder")\]  
If \[MBS ("IsError")\]  
 Show Custom Dialog \["We have a problem"; MBS ("[Text.RemovePrefix](TextRemovePrefix.md)"; $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

- [Events.AuthorizationStatusForEntityType](EventsAuthorizationStatusForEntityType.md)
- [IsError](IsError.md)
- [Text.RemovePrefix](TextRemovePrefix.md)

### Release notes

- **Version 13.3**
    - Fixed [Events.RequestAccessToEntityType](https://www.mbsplugins.eu/EventsRequestAccessToEntityType.shtml) to return "Wait" not as error. And to wait up to 10 seconds for dialog response.

### Blog Entries

- [MBS FileMaker Plugin, version 13.3pr7](https://www.mbsplugins.de/archive/2023-07-12/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [macOS Privacy and FileMaker](https://www.mbsplugins.de/archive/2020-08-11/macOS_Privacy_and_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Calendar access in FileMaker 18](https://www.mbsplugins.de/archive/2019-07-12/Calendar_access_in_FileMaker_1/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 3/2020, Seite 37](https://filemaker-magazin.de/neuigkeit/4096-Appetithappen-FMM_202003)

This function checks for a license.

Created 10th March 2016 , last changed 17th January 2024

  
[Events.RemoveReminder](EventsRemoveReminder.md) - [Events.RequestFullAccessToEvents](EventsRequestFullAccessToEvents.md)

[HTML Version](EventsrequestAccessToEntityType.shtml)