---
title: Message Context Key Plugin – Return the Value of a Context Property by Key
description: Use the Nodinite Message Context Key Search Field Expression plugin to return the value of one context property, looked up by its exact key, with no pattern or parsing.
---

# :fa-magnifying-glass: Message Context Key Search Field Expression Plugin

The **Message Context Key** plugin returns the value of one context property of a [Log Event][], looked up by its **exact key**. There's no pattern and no parsing: the whole value becomes the [Search Field][Search Fields] value. Use it when a context property already holds exactly the value you want, such as an order number or a file name set by the sender.

* ✅ Simplest way to read a context value: enter the key, get the value  
* ✅ Reads only the context properties; the message body is never read  

![Message Context Key returns Northwind Traders from the CustomerName context key, animated walkthrough (7.12)][4]  
*Animated walkthrough: the key `CustomerName` on the context of a logged Order-to-Cash order confirmation returns the value `Northwind Traders`, as it is.*  

## :fa-scale-balanced: When to use it

Message Context Key and the four [RegEx][] plugins cover the combinations of *where the text is* and *what part of it you want*. For every plugin, see [Choose a plugin][].

| Your data | You want | Use |
| --- | --- | --- |
| One context value (you know the key) | The value as it is, no pattern | **Message Context Key** (this page) |
| One context value (you know the key) | The whole match of a pattern | [RegEx on Message Context][] |
| One context value (you know the key) | Only the part inside a capturing group `( )` | [RegEx on Message Context with capturing groups][] |
| XML stored in a context value | An XPath result | [XPath on Message Context][] |
| Message body | The whole match of a pattern | [RegEx][] |
| Message body | Only the part inside a capturing group | [RegEx with capturing groups][] |
| Several keys that match a pattern | Their values | [Formula][] with [`context(regex('…'))`][Formula context] |

## :fa-code: Expression syntax

Select **Message Context Key** in the **Type** list and enter the key in the **Expression** field.

![Type list open with the Expression Types, among them Message Context Key (7.12)][1]  
*The Message Context Key plugin in the Type list.*  

* The **Expression** is the key itself, not a pattern. Write it exactly as it's logged: the key is case-sensitive, so `customername` doesn't find `CustomerName`.
* The whole value is returned as it is, for example a full file path.
* [BizTalk][BizTalk Logging] context properties are logged as *namespace#property*, for example `http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName`.
* Context properties and the reserved keys are described in [Context Options][]. Properties that the [ContextPropertiesFilters][] [System Parameter][System Parameters] removes aren't kept, so don't base a [Search Field][Search Fields] on them.
* To test, add the key and its value on the **Message Context** tab of Test Expression. When the key is missing, the test reports *Processed with warning: The Expression yields no result*:

![Test Expression result: Processed with warning, The Expression yields no result (7.12)][3]  
*Test result when the key isn't among the context properties.*  

Configure and test the expression as described in [Add or manage Search Field][] and [Test Your Expression][].

## :fa-list-ol: Examples

### Example 1: Return the value of a custom context key

#### Input

| Key | Value |
| --- | --- |
| `ProductOfTheYear` | `Nodinite` |

#### Expression

```text
ProductOfTheYear
```

#### Result

```text
Nodinite
```

![Test Expression for Message Context Key returning Nodinite from the ProductOfTheYear context key (7.12)][2]  
*Test Expression: the value of `ProductOfTheYear` from the Message Context tab.*  

### Example 2: Return the full path of the file that BizTalk received

#### Input

| Key | Value |
| --- | --- |
| `http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName` | `C:\Integration\In\Orders\PO_4711.xml` |

#### Expression

```text
http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName
```

#### Result

```text
C:\Integration\In\Orders\PO_4711.xml
```

To keep only the file name `PO_4711.xml`, use [RegEx on Message Context][] with `([^\\]+$)`.

![Message Context Key test: the BizTalk ReceivedFileName key returns the full file path (7.12)][5]  
*The full `namespace#property` key returns the logged value as it is.*  

## :fa-hand-point-right: Next Steps

* :fa-plus: [Add or manage Search Field][]  
* :fa-flask: [Test Your Expression][]  
* :fa-signs-post: [Choose a plugin][]  

## :fa-link-horizontal: Related Topics

* :fa-magnifying-glass: [RegEx on Message Context][]  
* :fa-magnifying-glass: [RegEx on Message Context with capturing groups][]  
* :fa-magnifying-glass: [XPath on Message Context][]  
* :fa-magnifying-glass: [RegEx][]  
* :fa-magnifying-glass: [RegEx with capturing groups][]  
* :fa-function: [Formula][]  
* :fa-function: [Formula context][]  
* :fa-filter: [ContextPropertiesFilters][]  
* :fa-magnifying-glass-plus: [Search Field Expressions][]  
* :fa-magnifying-glass-plus: [Search Fields][]  

[1]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Message%20Context%20Key/Select.png
[2]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Message%20Context%20Key/Example1.png
[3]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/NoResult.png
[4]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Expression_ContextKey.gif
[5]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Message%20Context%20Key/Example2.png

[Add or manage Search Field]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Add%20or%20manage%20Search%20Field.md
[BizTalk Logging]:{ndr}/Logging%20and%20Monitoring/Microsoft%20BizTalk%20Server%20-%20Logging/Overview.md
[Choose a plugin]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Overview.md#fa-signs-post-choose-a-plugin
[Context Options]:{ndr}/Core%20Services/Log%20Event/Features/Context%20Options.md
[ContextPropertiesFilters]:{ndr}/Administration/5.%20Settings/5.%20System%20Parameters/ContextPropertiesFilters.md
[Formula]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Formula/Overview.md
[Formula context]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Formula/Source/context.md
[Log Event]:{ndr}/Core%20Services/Log%20Event/Overview.md
[RegEx]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/RegEx.md
[RegEx on Message Context]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/RegEx%20on%20Message%20Context.md
[RegEx on Message Context with capturing groups]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/RegEx%20on%20Message%20Context%20with%20capturing%20groups.md
[RegEx with capturing groups]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/RegEx%20with%20capturing%20groups.md
[Search Field Expressions]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Overview.md
[Search Fields]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/What%20is%20a%20Search%20Field.md
[System Parameters]:{ndr}/Administration/5.%20Settings/5.%20System%20Parameters/Overview.md
[Test Your Expression]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Add%20or%20manage%20Search%20Field.md#test-your-expression
[XPath on Message Context]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/XPath%20on%20Message%20Context.md