AzureIoTHubGetMsgId
- Last UpdatedOct 29, 2026
- 2 minute read
AzureIoTHubGetMsgId returns the ID of the specified index value of an Azure IoT Hub connection. See Notes for more information.
|
Function |
Group |
Execution |
String Exp. |
Windows |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|
|
AzureIoTHubGetMsgId |
Internet of Things |
Synchronous |
Yes |
Supported |
Not supported |
Supported |
Supported |
Syntax
AzureIoTHubGetMsgId(strAlias, nIndex)
strAlias
The name of the Azure IoT Hub connection that you want to use. The connection can be created either during project development (in the Project ExplorerTasks tab Internet of Things folder) or during project run time (by calling the AzureIoTHubOpen function).
nIndex
Zero-based index of the message.
Return value
If successful, this function returns the message ID (a positive integer).
If unsuccessful, this function returns one of the following negative integer values:
|
Value |
Description |
|---|---|
|
-300 |
Invalid alias detected by server |
|
-301 |
Invalid connection parameter |
|
-302 |
Invalid message parameter |
|
-303 |
Invalid type parameter |
|
-304 |
Invalid property parameter |
|
-305 |
Invalid message ID parameter |
|
-306 |
Connection has not been defined |
|
-307 |
Conflicting alias |
|
-308 |
Open connection error |
|
-309 |
Invalid command |
|
-310 |
Communication error |
|
-311 |
Invalid parameter index |
Notes
Messages are kept in the Gateway ("alive" in the IoT Hub queue) for up to 10 minutes before they are deleted from the queue. (The settings for messages are currently configured in the IoT Hub settings.) The Gateway has a limit of 100 messages per connection; older messages (in terms of creation time) will be deleted to make room for newer messages.
This function requires an open IoT Hub connection. The connection can be created either during project development (in the Project ExplorerTasks tab Internet of Things folder) or during project run time (by calling the AzureIoTHubOpen or AzureIoTHubSendMsg functions).
Examples
As used in a Math worksheet:
|
Tag Name |
Expression |
|---|---|
|
nMsgId |
AzureIoTHubGetMsgId ("Test", 0) |