Get selected options from Multiselect Option set

crm backlog


Recently had a requirement to get all selected option texts from a multi select option set. Getting selected values is straight forward but I wanted to get the Label of selected values. For normal option set we can get it easily by using FormattedValues but that does not work with Multiselect Option set.

For C#:

Then found an handy code by Ravi Kashyap that was posted on community here. I have just restructured the function to make it generic.

Now just call the getSelectedOptionSetText() function and pass Organization Service, entity name and MultiSelect optionset field name.

The function first retrieves all the labels from the Option Set and then filters it with selected option set values.

public string getSelectedOptionSetText(IOrganizationService service, Entity enRecord, string fieldName)
string selectedText = string.Empty;
// Get the Formatted Values of MultiSelect OptionSet
List multiSelectTextCollection = GetOptionSetTextCollection(service, enRecord.LogicalName, fieldName);

if (enRecord.Contains(fieldName))
OptionSetValueCollection multiSelectValueCollection…

View original post 135 more words

Sponsored Post Learn from the experts: Create a successful blog with our brand new courseThe Blog

Are you new to blogging, and do you want step-by-step guidance on how to publish and grow your blog? Learn more about our new Blogging for Beginners course and get 50% off through December 10th. is excited to announce our newest offering: a course just for beginning bloggers where you’ll learn everything you need to know about blogging from the most trusted experts in the industry. We have helped millions of blogs get up and running, we know what works, and we want you to to know everything we know. This course provides all the fundamental skills and inspiration you need to get your blog started, an interactive community forum, and content updated annually.

Counting the current number of IoT Hub messages and devices

Sander van de Velde

Microsoft provides SDKs for both building IoT devices and accessing the IoT Hub (based on several programming languages).

Regarding the IoT Hub, with the SDK you are able to eg. register and control devices.

Still, some actions are possible with the IoT Hub which is not supported by the SDK.

For those actions, Microsoft supports an IoTHub Rest API which extends the capabilities of the SDK.

In the past, I demonstrated how to work with C2D messages using the REST API.

A few days back, I came along with this MS Learn question about IoT Hub message counts. This also has to be tackled by the REST API.

Let’s see how.

View original post 507 more words

Send Telemetry data to your Azure IOT Hub…using Device Client SDK’s…

In the earlier blog post, we have seen how to connect to your Azure IOT Hub using Raspberry PI Online Simulator and send telemetry data…

In this post, we will be using Azure IOT Device Client SDK’s for sending the Telemetry data to IOT Hub…

This approach uses .NET Core SDK libraries using a Console application….

Creating a C# Console Application

  1. Open Visual Studio, go to File -> New -> and select Project.
  2. In Templates, select Visual C#, select Console App (.NET Framework) and give an appropriate name in the ‘Name’ textbox and then click the OK button.

3. Installing Microsoft Azure IOT Device Client SDK…Go to Project -> Manage NuGet Packages.

4. Click Browse tab and search for Microsoft.Azure.Devices.Client. You will see the Microsoft.Azure.Devices.Client device SDK will have listed in the search result and click Install button

5. Now, click the I Accept button to accept the license agreement.

6. It will take a few minutes to install the SDK in our project

7. Get IoT device connect string from Azure IoT Hub…navigate to Azure Portal –> IOT Hub –> IOT Devices –> Select respective device to be connected.

  1. Using Microsoft.Azure.Devices.Client library we can create device client. The device client has CreateFromConnectionString method which requires device connection string as parameter. Create a read only static string s_connectionString01 and assign the connection string that we copy from Azure Portal.
  2. Here you can create a random temperature and humidity values using Random() method.
  3. Copy the code in the Program.cs from the GitHub repository

That’s it. Now, run the web application, go to Debug menu, and click on “Start without Debugging” or press F5. This will display the below result 

How To Send Telemetry From An IoT Device To The Azure IoT Hub Using C#

Hope you had learned a new approach to send telemetry data to Azure IOT Hub…stay tuned…for more on Azure IOT….

Hope this helps….



Using Client script to connect your device Azure IOT Hub

This post is to understand the Node.js code used to connect to Azure IOT Hub…the complete code can be found This post is just to explain in detail for beginners to understand this quickly.

Navigate to this link…

Now we will understand the code in the integrated console window as highlighted below…

So let’s understand each piece of it…

Firstly we need to understand about controlling the GPIO pins of the Raspberry PI…for high performance C language should be preferred language used but most developers are more comfortable with JS/Node…node.js is used.

So in order to read the pins, we should be using package require(‘wiring-pi’);

Next we will be requiring Azure IOT Device Client SDK’s to create a client for interaction with the Raspberry PI and to send messages


Based on the protocol being used, we need to import the respective package..

The following table provides the high-level recommendations for your choice of protocol:

ProtocolWhen you should choose this protocol
MQTT over WebSocket
Use on all devices that do not require to connect multiple devices (each with its own per-device credentials) over the same TLS connection.
AMQP over WebSocket
Use on field and cloud gateways to take advantage of connection multiplexing across devices.
HTTPSUse for devices that cannot support other protocols.

MQTT and AMQP are binary protocols, which result in more compact payloads than HTTPS, this sample uses MQTT Protocol for communication, hence below package is used


For bme280-sensor, a Node.js I2C module for the Bosch BME280 Humidity, Barometric Pressure, Temperature Sensor, used below


Regarding the connection string, you can follow my previous post on getting this from Azure Portal, however there is also an alternative to use SDK’s

There is a function in azure-iot-device npm (IoT Hub Device SDK for Node.js) to generate device connection string:

import { ConnectionString as DeviceConnectionString } from "azure-iot-device";
const deviceConnectionString = DeviceConnectionString.createWithSharedAccessKey(hostName, device.deviceId, device.authentication.SymmetricKey.primaryKey);

You could also refer to full code here to see how Azure IoT Toolkit generates the device connection string.

The next part is the custom logic on sending messages based on the temperature sensor to Azure IOT Hub and switching on the LED based conditions which is completely based on the needs…

Hope this helps…



Connecting Raspberry Pi using Azure IOT Online Simulator


This is my first post in the Azure IOT series….and really excited to share this content.

Have you ever tried a lot to get some hands-on experience connecting devices to Azure IOT Hub. Don’t worry…Microsoft IOT Team had made it so easy so that we can connect to a real device like Raspberry Pi without actually having any physical hardware with you.

This is all possible with Open Sourced Raspberry Pi Online Simulator…with the below link..

Once you open this…you should see the below screen….all you need to enter your IOT Device connection string…

If you check in the above image, you could see that connectionString is highlighted which you need to get from Azure Portal. So lets see how you can get this from Azure portal…

Step 1: Create a free Azure account or if you already have one proceed to next step

Step 2: Create Azure IOT Hub from Azure portal

From the Azure homepage, select the + Create a resource button, and then enter IoT Hub in the Search the Marketplace field

In the results, click Create.

Step 3: Once the deployment is succeeded and your Azure IOT Hub got created, you need to create a device to which you will be connected by navigating as below. Select IOT Devices under Explorers available in the Side pane as highlighted below

Step 4:

Click on New Device as highlighted below

Step 5: Enter Device ID and click on save as higlighted below

Step 6: Now Open your device by click on IOT Devices…and grab the primary connection string..make sure Enable connection to IOT Hub is enabled as below.

Step 7: Now go back to Raspberry PI Simulator and enter this connection string at the place shown in the first image.

Step 8: And finally boom…you will see that the message sent to Azure…and the bulb was switched on.

In the next post, will briefly describe on the Node.js code used and also on the Device SDK’s for Azure IOT so that we can gain more insight.

If you have any further questions on this….please post it here or you can reach out to Community Support on this tool at the below link…

Hope this helps….

Thank you.



Invalid subscription key error when connecting Azure cognitive services Face API

Saurabh nijhawan's weblog

Recently during an integration scenario with D365 Field services in order to identify if the person making a change to the Customer asset is an employee or not we spinned up an Azure Face API service and on trying to connect it from an Azure function we were getting Invalid key exception.

We were using the Face API client library which defaults to west US endpoint of the service but our service was in EastUS.

Default endpoint:

The solution is to override the endpoint to which can be done by using another constructor of the FaceServiceClient class

FaceServiceAPIClient = new FaceServiceClient("Face API subscription key", "");

View original post

Power Apps – Canvas Apps – Unable to obtain access token for resource ‘’. A silent sign-in request was sent but no user is signed in. The cookies used to represent the user’s session were not sent in the request to Azure AD

Bansal Blogs - Dynamics 365, PowerApps, Microsoft Flows, Power BI


Power Apps recently introduced sharing capabilities with Guest Users. Upon sharing users were not able to access app because of error “Unable to obtain access token for resource ‘’. A silent sign-in request was sent but no user is signed in. The cookies used to represent the user’s session were not sent in the request to Azure AD”.

As we were investigating this issue and reaching out to Microsoft support team, we came to know this is not just for Guest users and because of browser cookie settings. Make sure third-party cookies are not blocked and enabled. You can refer below steps to enable third party cookies:

Microsoft Edge:

  • Go to Settings from right side navigation


  • Click on Site Permissions in Left side navigation and select Cookies and site data


  • Make sure options are enabled and disabled as shown below


  • Go to Settings from right side navigation


  • Expand Advanced…

View original post 42 more words

Log Canvas Power App telemetry data in Azure Application Insights | Power Apps

D365 Demystified

Here’s how you can register your Canvas Power App in your Azure’s Application Insights and log telemetry data into Azure.

Some basic info about what all you can see in Application Insights is –

  1. Count of Users who used the app
  2. Events logged, Sessions logged
  3. Device info
  4. Region info

It’s quite simple to set it up! Let’s take a look –

Registering in Application Insights in Azure

First, make sure you do have an Azure Subscription. Let’s look at how you can register an Application Insight record.

  1. Look for Application Insights in Azure in the search bar
  2. Then, among other records, you can register a new one which will identify with your Canvas Power App
  3. Review all that you entered and move ahead
  4. It’ll be deployed pretty quickly within a few minutes unlike some heavy Azure resources
  5. Upon completion, you can navigate to the resource and see the details


View original post 374 more words

Power Automate Cookbook

Hey Power Automate Fans!!,

Have u ever tried to checkout some of the cool examples and recipes developed by Power Automate Community.

If not, please check this out at this link

Check out this link to submit your flow to the Community cookbook….



How to create an app to Scan Receipts

Hi Folks,

Have u ever tried creating an App using Azure Cognitive Services.

Here is an excellent video tutorial on how to create an app to Scan Receipts using Azure Cognitive Services Form Recognizer API from MVP @Vivek Bhavishi..

Additional Resources:
Form Recognizer API Docs –

Form Recognizer API Reference –

Hope you will find it useful…