Events.SaveEvent
----------------

Saves changes to an event permanently.

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

MBS( "Events.SaveEvent"; EKEvent; Span { ; Commit } ) 

**MBS**( **"Events.SaveEvent";** /\* Saves changes to an event permanently. \*/  
**$EKEvent**; /\* The reference to the event.e.g. $event \*/   
**$Span**; /\* The span to use.  
This event, or this and future events.  
Pass "This" or "Future" here.e.g. "This" \*/   
**$Commit**) /\* Optional; Whether to commit.  
Pass 1 to commit or 0 to not commit.  
Default is 1.  
Pass 0 to batch changes together and commit with [Events.Commit](EventsCommit.md) later.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| EKEvent | The reference to the event. | $event |  |
| Span | The span to use.   This event, or this and future events.   Pass "This" or "Future" here. | "This" |  |
| Commit | Whether to commit.   Pass 1 to commit or 0 to not commit.   Default is 1.   Pass 0 to batch changes together and commit with [Events.Commit](EventsCommit.md) later. | 1 | Optional |

### Result

Returns OK or error.

### Description

Saves changes to an event permanently.  
This function attempts to save the event to the calendar database. It returns OK if successful and error otherwise. It's possible for this function to return failed. This occurs if the event wasn't dirty and didn't need saving.   
After an event is successfully saved, it is also put into sync with the database, meaning that all fields you did not change will be updated to the latest values. If you save the event, but it was deleted by a different store/process, you will effectively recreate the event as a new event.  
  
You may still need to call [Events.Commit](EventsCommit.md) later.  
### Examples

Update dates:

 Set Variable \[$c ; Value:CalendarTest::ItemUID \]  
Set Variable \[$r ; Value:MBS ("[Events.Event.SetEndDate](EventsEventSetEndDate.md)"; $c ; CalendarTest::ItemEndDate )\]  
Set Variable \[$r ; Value:MBS ("[Events.Event.SetStartDate](EventsEventSetStartDate.md)"; $c ; CalendarTest::ItemStartDate )\]  
Set Variable \[$r ; Value:MBS ("Events.SaveEvent"; $c ; "this"; 1 )\]  
Create event:

 Set Variable \[$c ; Value:MBS ("[Events.NewEvent](EventsNewEvent.md)")\]  
Set Variable \[$r ; Value:MBS ("[Events.Item.SetTitle](EventsItemSetTitle.md)"; $c ; CalendarTest::ItemTitle )\]  
Set Variable \[$r ; Value:MBS ("[Events.Item.SetNotes](EventsItemSetNotes.md)"; $c ; CalendarTest::ItemNotes )\]  
Set Variable \[$r ; Value:MBS ("[Events.Item.SetURL](EventsItemSetURL.md)"; $c ; CalendarTest::ItemURL )\]  
Set Variable \[$r ; Value:MBS ("[Events.Item.SetLocation](EventsItemSetLocation.md)"; $c ;CalendarTest::ItemLocation )\]  
Set Variable \[$r ; Value:MBS ("[Events.Event.SetStartDate](EventsEventSetStartDate.md)"; $c ; CalendarTest::ItemStartDate )\]  
Set Variable \[$r ; Value:MBS ("[Events.Event.SetEndDate](EventsEventSetEndDate.md)"; $c ; CalendarTest::ItemEndDate )\]  
Set Variable \[$r ; Value:MBS ("[Events.Event.SetAllDay](EventsEventSetAllDay.md)"; $c ;CalendarTest::ItemAllDay )\]  
Set Variable \[$r ; Value:MBS ("[Events.Event.SetAvailability](EventsEventSetAvailability.md)"; $c ; "busy")\]  
Set Variable \[$r ; Value:MBS ("[Events.Item.SetCalendar](EventsItemSetCalendar.md)"; $c ; CalendarTest::CalendarUID )\]  
Set Variable \[$r ; Value:MBS ("Events.SaveEvent"; $c ; "this"; 1 )\]  
Set Field \[CalendarTest::ItemUID ; MBS ("[Events.Item.CalendarItemIdentifier](EventsItemCalendarItemIdentifier.md)"; $c )\]  
### See also

- [Events.Commit](EventsCommit.md)
- [Events.Event.SetAllDay](EventsEventSetAllDay.md)
- [Events.Event.SetAvailability](EventsEventSetAvailability.md)
- [Events.Event.SetEndDate](EventsEventSetEndDate.md)
- [Events.Event.SetStartDate](EventsEventSetStartDate.md)
- [Events.Item.SetCalendar](EventsItemSetCalendar.md)
- [Events.Item.SetLocation](EventsItemSetLocation.md)
- [Events.Item.SetTitle](EventsItemSetTitle.md)
- [Events.RemoveEvent](EventsRemoveEvent.md)
- [Events.SelectEvent](EventsSelectEvent.md)

### Example Databases

- [Mac and iOS/Events/Events Create Event](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Events/Events%20Create%20Event.shtml#1ScriptAnchor_)
- [Mac and iOS/Events/Events Sync](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Events/Events%20Sync.shtml#5ScriptAnchor_)

### Blog Entries

- [FileMaker and Calendar (iCal)](https://www.mbsplugins.de/archive/2016-04-23/FileMaker_and_Calendar_(iCal)/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

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

This function checks for a license.

Created 10th March 2016 , last changed 17th March 2021

  
[Events.SaveCalendar](EventsSaveCalendar.md) - [Events.SaveReminder](EventsSaveReminder.md)

[HTML Version](EventsSaveEvent.shtml)