Calendar.Item.SetCalendar
-------------------------

Assigns a calendar to the calendar item.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Calendar](component_Calendar.md) | [3.4](newinversion34.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

### Deprecated

This function was [deprecated](deprecated.md).

MBS( "Calendar.Item.SetCalendar"; itemRef; calendarRef ) 

**MBS**( **"Calendar.Item.SetCalendar";** /\* Assigns a calendar to the calendar item. \*/  
**$itemRef**; /\* The reference to the calendar item. Can be reference to event or reminder.e.g. $eventRef \*/   
**$calendarRef**) /\* The id of the calendar to query. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| itemRef | The reference to the calendar item. Can be reference to event or reminder. | $eventRef |
| calendarRef | The id of the calendar to query. | $calendarRef |

### Result

Returns OK or error.

### Description

Assigns a calendar to the calendar item.  
### Examples

Create a new reminder:

 $id = MBS ("[Calendar.NewReminder](CalendarNewReminder.md)")  
$r = MBS ( "[Calendar.Item.SetDueDate](CalendarItemSetDueDate.md)"; $id ; Get(CurrentHostTimeStamp) )  
$r = MBS ( "[Calendar.Item.SetTitle](CalendarItemSetTitle.md)"; $id ; "Test" )  
$r = MBS ( "Calendar.Item.SetCalendar"; $id ; "Erinnerungen" )  
$r = MBS ( "[Calendar.SaveReminder](CalendarSaveReminder.md)"; $id )  
Create new event:

 Set Variable \[$c ; Value:MBS ("[Calendar.NewEvent](CalendarNewEvent.md)")\]  
\# set title and other variables   
Set Variable \[$r ; Value:MBS ("[Calendar.Item.SetTitle](CalendarItemSetTitle.md)"; $c ; CalendarTest::ItemTitle )\]  
Set Variable \[$r ; Value:MBS ("[Calendar.Item.SetStartDate](CalendarItemSetStartDate.md)"; $c ; CalendarTest::ItemStartDate )\]  
Set Variable \[$r ; Value:MBS ("[Calendar.Item.SetEndDate](CalendarItemSetEndDate.md)"; $c ; CalendarTest::ItemEndDate )\]  
Set Variable \[$r ; Value:MBS ("[Calendar.Item.SetAllDay](CalendarItemSetAllDay.md)"; $c ;CalendarTest::ItemAllDay )\]  
Set Variable \[$r ; Value:MBS ("Calendar.Item.SetCalendar"; $c ; CalendarTest::CalendarUID )\]  
\# save event   
Set Variable \[$r ; Value:MBS ("[Calendar.SaveEvent](CalendarSaveEvent.md)"; $c )\]  
### See also

- [Calendar.Item.SetAllDay](CalendarItemSetAllDay.md)
- [Calendar.Item.SetCompleted](CalendarItemSetCompleted.md)
- [Calendar.Item.SetDueDate](CalendarItemSetDueDate.md)
- [Calendar.Item.SetEndDate](CalendarItemSetEndDate.md)
- [Calendar.Item.SetStartDate](CalendarItemSetStartDate.md)
- [Calendar.Item.SetTitle](CalendarItemSetTitle.md)
- [Calendar.NewEvent](CalendarNewEvent.md)
- [Calendar.NewReminder](CalendarNewReminder.md)
- [Calendar.SaveEvent](CalendarSaveEvent.md)
- [Events.Item.SetCalendar](EventsItemSetCalendar.md)

### Example Databases

- [Mac and iOS/Events/Calendar/Calendar Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Events/Calendar/Calendar%20Test.shtml#4ScriptAnchor_)
- [Mac and iOS/Events/Calendar/Reminders](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Events/Calendar/Reminders.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 16 - Add Entries In Apple Calendar](https://www.mbsplugins.de/archive/2024-12-16/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Todo/Reminder Synchronization for FileMaker on Mac using MBS Plugin](https://www.mbsplugins.de/archive/2016-09-22/TodoReminder_Synchronization_f/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 1/2014, Seite 31 bis 33](https://filemaker-magazin.de/neuigkeit/3720-Appetithappen-FMM_201401)

This function checks for a license.

Created 18th August 2014 , last changed 31st October 2015

  
[Calendar.Item.SetAllDay](CalendarItemSetAllDay.md) - [Calendar.Item.SetCompleted](CalendarItemSetCompleted.md)

[HTML Version](CalendarItemSetCalendar.shtml)