How to: Use a dropdown to select the location for an event

When creating an event from a calendar you can usually only use a text box to specify the location of an event. This is because the location column is sealed and you cannot change the field type of this column.

Location text box

However, if you wish to use a dropdown to select the location, there are 3 possible options to achieve this.

1. Unseal the location column and change it to choice

Use the following SharePoint power shell script to change the seal property of the location column:
Replace “yoursite” and “Your Calendar” with your own site address and calendar name.

$web = Get-SPWeb http://yoursite
$list = $web.Lists["Your Calendar"]
$field = $list.Fields.GetFieldByInternalName("Location")
$myAss = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $myAss.GetType("Microsoft.SharePoint.SPField");
[System.Reflection.BindingFlags]$flags = [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic
$SetFieldBoolValue = $type.GetMethod("SetFieldBoolValue",$flags)
$arr = @()
$arr+="Sealed"
$arr+=$false 
$SetFieldBoolValue.Invoke($field, $arr);
$arr = @()
$arr+=$true 
$method = $type.GetMethod("UpdateCore", $flags);
$method.Invoke($field, $true);
$web = Get-SPWeb http://yoursite
$list = $web.Lists["Your Calendar"]
$field = $list.Fields.GetFieldByInternalName("Location")
$myAss = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $myAss.GetType("Microsoft.SharePoint.SPField");
[System.Reflection.BindingFlags]$flags = [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic
$SetFieldBoolValue = $type.GetMethod("SetFieldBoolValue",$flags)
$arr = @()
$arr+="Sealed"
$arr+=$false 
$SetFieldBoolValue.Invoke($field, $arr);
$arr = @()
$arr+=$true 
$method = $type.GetMethod("UpdateCore", $flags);
$method.Invoke($field, $true);

Now you can change the column type to Choice and add locations you require for the dropdown.

Column type settings

Location dropdown

2. Create an additional column and use an event receiver

Create an additional location column which has its type set to choice and then add all the desired locations. You can then use an event receiver to set the location based on your custom location in ItemAdding and ItemUpdating.

3. Create an additional column and use a workflow

For this option you also need to create an additional location column which has its type set to choice and then add all the desired locations. You can then base the location column on your custom location column using a SharePoint designer workflow that runs when an item is created or changed. Use the “Set Field in Current Item” action in the workflow.

Workflow 1

Please note that if you use the Calendar E-Mail Extension and enter attendees when scheduling the event, these attendees will receive two invitations. One without a location and then an update with the correct location.

To prevent this from happening you should change the default value of the “Activate Event” column to “No” so that attendees will not receive any invitations. In the workflow you should then set this column to “Yes” when the location column is updated. To do this you can use the “Update List Item” workflow action.

Workflow 2

Please note that if you change the location and, for example, the start time afterwards, attendees will once again receive two invitations.

I hope you found this guide useful. If you have any problems or any other questions, please send an e-mail to [email protected] or post a comment.