Microsoft Power Platform: Checking vaccine slot availability using the COWIN API and Power Automate

Recently government opened the vaccination for 18 – 45 years age group from May 1st. When I registered on Co-WIN portal and I tried to search the available slots for 18+ age group, but always I see the slot is filled up already. After searching I found that Co-WIN provides sets of API’s which are available openly for all the third parties. You can read mode at

I crated a Power Automate flow to check the slot availability and alert the use through email. I have used ‘calendarByPin’ API. Which provides us “vaccination sessions by PIN for 7 days”.

I have crated a SharePoint list which will hold the pincodes for which are checking availability of slots. You can use any other data source as per your convenience.

Flow will go through the list and check the availability for each pin code. I will not explain much technically, please find the flow screenshots of the steps in flow.

Current date variable will be set though following formula –


The flow will look like end to end as –

I am attaching the exported flow Download and rename it before importing in to ‘Power Automate’.

You will get email like following, in your mailbox.

Points to be remembered –

  1. Co-WIN provides sets of API’s are provided by Co-WIN and it is getting used in the active ‘Co-WIN’ portal so please don’t hit the API’s with short duration. And choose the trigger duration wisely. I have set it to every 1 hr. You can change it as per your need.
  2. You can create an ‘E5 Office 365 E5 Trial’ site and import the flow. While importing you need to resolve ‘Office 365 Outlook Connection’ and ‘SharePoint Connection’.
  3. After importing flow, you need to select your site URL and list of pincodes to be selected.
  4. I have used API in Power Automate as no code solution, you can use other ways to pull data from API like windows application, Azure web job and other ways or scheduled Azure functions etc.
  5. The attached sample I am searching 18+ age slots, if you want to search for 45+ then do the changes accordingly in the Condition section.
  6. You also need to update your Email Id in the ‘Send an email’ step.
  7. Instead of sending email, you can use any other way like sending SMS alert or something other according to the availability of the operation.
  8. HTTP operation is paid operation in Power Automate but mostly your need will suffice with the E5 quota available for HTTP calls.
  9. The entire purpose of this article is just to make the idea that how we can utilize the power Automate in this scenario. I am not taking any responsibility of the data authenticity as we are just consuming the provided API.
  10. I have not done extensive testing of this flow but in some amount of testing it found to be working. Some fixes may be needed in some scenarios.
  11. The appointment availability data is cached and may be up-to 30 minutes old. Further, these APIs are subject to a rate limit of 100 API calls per 5 minutes per IP.


Microsoft Power Platform: Convert HTML to PDF using OneDrive Actions in Power Automate

April 6, 2021 4 comments

Hi friends,

In one of my previous blog post I explained how to convert HTML to PDF using PDFShift API. PDFShift is paid product and can be used in specific sacnorao like converting to PDF by passing the URL of the page and other complex sacnorao.

If you do not have any complex requirement and you have data coming from SharePoint or anywhere from Office 365 ecosystem, then you can user OneDrive actions to convert HTML to PDF.

Following example will show you how to read the data for newly added list item and convert it to PDF and send an email it as attachment. OneDrive license needed for users.

I have created a sample SharePoint list with name as “Test” with columns ‘Title’, ‘Name’ and ‘Address’ –

Temp list columns and data
Temp list columns and data

Created a flow with ‘item created’ event. Selected my SharePoint list and added ‘Get item’ activity to get the newly created item. You can change it according to your requirement and according to suitable event for your requirement.

Trigger workflow on item created

After this getting the list item, we can create a HTML for that item. I used following formula to get the HTML string for list item –

Value : concat(‘<html><body><table height=”100%” width=”100%” style=”background-color:powderblue”><tr><th>Title</th><th>Name</th><th>Address</th></tr><tr><td>’,outputs(‘Get_item’)?[‘body/Title’],'</td><td>’,outputs(‘Get_item’)?[‘body/Name’],'</td><td>’,outputs(‘Get_item’)?[‘body/Address’],'</td></tr></table></body></html>’)

Initialize variable for HTML string

Once we get created the HTML for list item then we need to use ‘Create file’ action of OneDrive to create a HTML file.

File Name: concat(outputs(‘Get_item’)?[‘body/Name’],’.html’)

File Content: HTML string created in previous step

Create HTML file

After creating HTML file in OneDrive, we need to use ‘Convert file using path’ connector of OneDrive to convert HTML file to PDF file. Please note that this action is “Preview” state.

File Path: Path of the HTML file created in previous step

Target Type: PDF

Convert HTML file to PDF

Now save the converted PDF content to a PDF file using ‘Create File’ action of OneDrive.

Folder Path: root (/)

File Name: concat(outputs(‘Get_item’)?[‘body/Name’],’.pdf’)

File Content: File Content from previous step

Create PDF file from converted HTML content

Now as we have created a PDF file, we need to get the content of the file to send it as attachment in email.

To get the PDF content we can use ‘Get file content’ action of OneDrive.

File: ID of the file created in previous step.

Get PDF file content

Now when we get the PDF file content, we need to assign it to a Object type variable, like following.

Initialize variable Object to hold PDF file content

As we wanted to send the PDF file as attachment to email, we need to create a Array type variable and add the PDF file content we gathered in previous step using JSON format.

Name: concat(outputs(‘Get_item’)?[‘body/Name’],’.pdf’)

ContentBytes: We got from previous step

Initialize variable of Array type and append to array variable

We can use ‘Send an email (V2)’ action to send an email with attachment.

Send an email (V2) with attachment

Let’s save and test our flow till this point by creating new item in “Test” list , like following –

Temp list columns and data
Temp list columns and data

Wait for some time to get the workflow triggered.

Now if we check in OneDrive root, we can see that HTML and PDF file gets created at root –

HTML and PDF file gets created in OneDrive root

And can see that email landed in mailbox-

Email received in Inbox

With the contents like following –

Received pdf in email

Entire workflow will look like –

Entire Flow

As you can see that we are creating HTML and PDF file in OneDrive root, if we don’t want those files and wanted to be deleted at the end we can use ‘Delete File’ action from OneDrive. We will call the ‘Delete File’ action twice, once for HTML file and then again for PDF file like following.

Delete HTML and PDF files from OneDrive

Now, no file will occupy space in OneDrive as those will get deleted at the end of the flow. I have exported the flow and you can download and import in your tenant.

I have attached the exported flow Download and rename it to .zip

Azure App service API error while accessing Azure SQL database through entity framework: An error has occurred.

While working on Azure API which is created to access Azure SQL data. We have a requirement where we need to access Azure SQL table data and display it in React based SPFX web part on SharePoint online modern site. To achieve that we have created a Azure SQL database and created a table in that. We have created a RESTful web api which will be deployed as Azure APP. After deployment we are getting error “An error has occurred.” While accessing the API in browser.

Error we are getting while accessing API
Error we are getting while accessing API

While debugging I figured that api is working well on localhost.

Working from localhost
Working from localhost

It was bit surprising to me first that it is working on localhost but not after deployment of Azure app.

When I checked Azure SQL database “Set server firewall settings” I found that I have added my local machine IP in the allowed IP list to access DB using SQL management studio. Hence found it is working from my localhost. So, after finding the reason I started checking which IP I need to provide in the allowed IP list in Azure SQL database “Set server firewall settings” settings so that my Azure APP deployed API will be able to access the Azure SQL, but the IP address is not known to me as I have not explicitly configured it for using any specific IP address.

Solutions –

We can solve this by using 2 approaches.

  1. Finding the IP address of the Azure app and provide that in “Set server firewall settings” in Azure SQL database.

For that, I added <customErrors mode=”Off” /> in the web.config of VS solution.

VS solution Web config error mode added
VS solution Web config error mode added

And re-published the App again to Azure.

Now after that if you access the API in browser again, you will get the detail error like following –

Detailed error report with IP address
Detailed error report with IP address

This will also have the App IP address which you can use to add in the Azure SQL database “Set server firewall settings”.

Azure SQL database “Set server firewall settings”
Azure SQL database “Set server firewall settings”

And it will start working. This approach will work well in case you don’t want to share the SQL DB with other Azure resources as well.

  • Second option is bit easy, in Azure SQL database “Set server firewall settings” there is a flag, “Allow Azure services and resources to access this server”.
Azure SQL database “Set server firewall settings” 2
Azure SQL database “Set server firewall settings” 2

After any of the above changes my API started working from Azure web app.

Final result after changes
Final result after changes

Microsoft Power Platform: Converting HTML to PDF in Power Automate using PDFShift API

January 11, 2021 5 comments

Recently I worked on PDFShift for converting HTML to PDF with header and footer. I checked if we have any article which will explain how to use PDFShift API to convert HTML to CSS, but I do not find any article on this. Hence, I tried myself and made it through.

We have some other service provider for PDF conversion API’s which are already available in form of connection in Microsoft 365, example Muhimbi, Plumsail and others. So, after your evaluation of cost and features, if you have chosen PDFShift then you can use this article.

This article will explain you how we can call PDFShift API to convert the list item data in PDF and send the pdf as email.

PDFShift provides API to convert html to pdf, multiple features are provided with PDFShift. You can check more details and pricing details at

Some of the important feature of PDFShift like following –

Parallel conversions – Process multiple documents in parallel to increase conversion speed.

Asynchronous request – Use our powerful webhook system to be notified once a conversion is done.

Advanced Options – Set custom headers and footers with pagination, inject custom CSS and JavaScript, encrypt your documents and many more!

Raw HTML support – No need to make your private page public. Simply send us your raw HTML data instead and we will convert it.

High-Fidelity PDF – Generate a high-fidelity document, close to your original HTML, in a few seconds.

Privacy-focused – That’s why your documents are not stored on our server (except when explicitly requested) and are not kept for more than 2 days.

Asynchronous request feature is most important feature in real life sacnorao.

I tried to search any readily available connector for PDFShift, but do not found one.

I have created a sample SharePoint list with name as “Temp” with following columns –

Temp list columns and data
Temp list columns and data

Created a flow with item created. Selected my SharePoint list and added Get item activity to get the newly created item. You can change it according to your requirement and according to suitable event for your requirement.

Trigger workflow on item created
Trigger workflow on item created

After this getting the list item, we can create a HTML for that item. I used following formula to get the HTML for list item in Value

concat(‘<html><body><table border=”1px”><tr><th>Title</th><th>Name</th><th>Address</th></tr><tr><td>’,outputs(‘Get_item’)?[‘body/Title’],'</td><td>’,outputs(‘Get_item’)?[‘body/Name’],'</td><td>’,outputs(‘Get_item’)?[‘body/Address’],'</td></tr></table></body></html>’)

Initialize variable for HTML string
Initialize variable for HTML string

Once we get the HTML for list item, we used the HTTP action to call the PDFShift convert API. As PDFShift uses basic authentication, we used basic authentication in HTTP action to authenticate.

You need to provide the API key you get in the “Password” field and in “UserName” field pass value api

HTTP trigger action
HTTP trigger action

Now, we need to create a Variable of type “Object” to collect the output of the HTTP action.

In the next step create an “Array” type variable to create the Attachment array to be send with email.  

Initialize variable Object and Array type
Initialize variable Object and Array type

After creating Array variable, we need to assign the value which we get from HTTP call.

For attachment name let’s use the formula as following –


For PDF content let’s get the value from ‘’PDFOutput’ variable, like following –


Append to array variable
Append to array variable

After creating the array variable, we need to pass the array variable for Send email action.

Send an email (V2) action
Send an email (V2) action

Let’s pass the Attachment array variable in the ‘Send an email (V2)’ action like following.

Send an email (V2) with attachment
Send an email (V2) with attachment

The complete flow will look like following –

Entire Flow
Entire Flow

After creating a new item in the list ‘Temp’, our flow will get triggered and you will get the generated PDF attached in your inbox like following –

Email received in Inbox
Email received in Inbox

Converted PDF in email attachment will look like following –

Received pdf in email
Received pdf in email

If we explore the value of HTTP action and check the value of ‘PDFOutput’ variable, you will found the value like following where $content gives you PDF content in Base64 format.

Response From PDFShift with HTTP call
Response From PDFShift with HTTP call

You can use this approach in many application , for example insurance kind of application where details get filled from a Power app and gets stored in the SharePoint list, so as proof of the proposal the selected options get converted into PDF and stored in the SharePoint list as well as sent as an email.

Some more scenarios can be addressed similar ways.

You can add HEADER and FOOTER to PDF as well while calling the convert API, you can explore more options at PDFShift documentation at

Some important points to consider –

  1. HTTP Request action is a premium action and require premium licensing.
  2. PDFShift service is also paid service, you can visit their site for more details.

I have attached the exported flow Download and rename it to .zip

In upcoming blog, I will explain the real world monitoring sacnorao using the PDFShift and Power Automate to monitor the usage of the API.

SharePoint online: Error ‘Updates are currently disallowed on GET requests. To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb’ while creating new app catalog site

July 6, 2020 2 comments

Recently I have created new E5 personal tenant for my development and testing purpose. I wanted to deploy and test the SPFx component in that tenant, hence I tried to create the App catalog.

I directly went to SharePoint admin center in Office 365 and tried to create new App catalog site, like following.

App catalog Creation

App catalog Creation

I got the error ‘Updates are currently disallowed on GET requests. To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb’.

App catalog Creation Error

App catalog Creation Error

I initially thought that the error is due to some technical glitch and no clear reason of the error explained in error and hence I tried to create App catalog site couple of times more but no luck and got the same error.

The solution is bit weird as I just created new tenant, I do not have any site created yet and I jumped directly to create app catalog site.

Then I have created one test site in tenant.

One Site Created

One Site Created

And it worked, I again tried creating the App catalog site and it worked.

App Catalog Success

App Catalog Success

So we need to at least create one site before creating App catalog. The only concern is Microsoft should provide some meaningful error message so that we will not be confused.

Sharing is caring, stay safe. Take care.

Visual studio load test giving error- Request failed: The request was aborted: Could not create SSL/TLS secure channel

November 29, 2019 Leave a comment

Recently I ran the load tests in visual studio, I got errors “Request failed: The request was aborted: Could not create SSL/TLS secure channel”. Those load tests are working fine previously but suddenly stopped working. After investigation I found that recently our production server had some changes in TLS protocol support and now TLS 1.2 support added.

Request failed: The request was aborted: Could not create SSL/TLS secure channel.

Request failed: The request was aborted: Could not create SSL/TLS secure channel.

So, the cause found is recent change done on server but now finding the solution to resolve this issue and run the load test in visual studio.


We need to create Web Performance Test Plug-In to resolve this issue.

  1. Open a Web performance and load test project that contains a Web load test.
  2. In Solution Explorer, right-click on the solution and select Add and then choose New Project.The Add New Project dialog box is displayed.
  3. Under Installed Templates, select Visual C#.
  4. In the list of templates, select Class Library.
  5. In the Name text box, type a name for your class. Choose OK.
    Visual studio add new class library project
    Visual studio add new class library project
  6. The new class library project is added to Solution Explorer and the new class appears in the Code Editor.
  7. In Solution Explorer, right-click the References folder in the new class library and select Add Reference.
  8. The Add Reference dialog box is displayed.
  9. Choose the .NET tab, scroll down, and select Microsoft.VisualStudio.QualityTools.WebTestFramework. Choose OK.
  10. The reference to Microsoft.VisualStudio.QualityTools.WebTestFramework is added to the Reference folder in Solution Explorer.
    Visual studio add reference
    Visual studio add reference
  11. In Solution Explorer, right-click on the top node of the Web performance and load test project that contains the load test to which you want to add the Web performance test plug-in and select Add Reference.
  12. The Add Reference dialog box is displayed. Choose the Projects tab and select the Class Library Project. Choose OK.
    Visual studio add plugin project reference
    Visual studio add plugin project reference
  13. In the Code Editor, write the code of your plug-in. First, create a new public class that derives from WebTestPlugin.
  14. Implement code inside one or more of the event handlers.
  15.          public class Tls12ForcedPlugin : WebTestPlugin
            [Description("Enable or Disable the plugin functionality")]
            public bool Enabled { get; set; }
            public override void PreWebTest(object sender, PreWebTestEventArgs e)
                base.PreWebTest(sender, e);
                // We're using SSL2 here and not TLS. Without this line, nothing works.
                ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc00);// SecurityProtocolType.Ssl2;
                //we wire up the callback so we can override  behavior and force it to accept the cert
                ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCB;
                //let them know we made changes to the service point manager
                e.WebTest.AddCommentToResult(this.ToString() + " PP has made the following modification-> ServicePointManager.SecurityProtocol set to use SSLv3 in WebTest Plugin.");
            public static bool RemoteCertificateValidationCB(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
                //If it is really important, validate the certificate issuer here.
                //this will accept any certificate
                return true;
  16. If you are using Framework 4.0 then you may get error SecurityProtocolType.Ssl2 not found.For other Framework –

    SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12

    For Framework 4.0

    (SecurityProtocolType)(0xc0 | 0x300 | 0xc00)

  17. After you have written the code, build the new project.
  18. Open a Web performance test. To add the Web performance test plug-in, choose Add Web Test Plug-in on the toolbar.
  19. The Add Web Test Plug-in dialog box is displayed. Under Select a plug-in, select your Web performance test plug-in class.
  20. Visual studio plugin project displayed

    Visual studio plugin project displayed

  21. In the Properties for selected plug-in pane, set the initial values for the plug-in to use at run time. Choose OK.
    Visual studio error resolved
    Visual studio error resolved

Step by step installation of SharePoint Server 2019 preview for single server farm topology

July 26, 2018 1 comment

Hi Friends,

As we know that SharePoint Server 2019 and Project Server 2019 preview available, I was excited with this news and thought to have it installed on and check what’s now.
Following article will have instructions to install SharePoint Server 2019 preview on Azure VM.
Let’s start by creating the virtual machine on Windows Azure platform.
I have created a VM with image template ‘SQL Server 2017 Standard on Windows Server 2016’.

SP2019_Azure VM Image

I have chosen ‘Standard B4Ms’ sizes configuration.

SP2019_Azure VM

And created the VM, it have taken some time to get it created. Following are the configuration shown on the created VM on Azure.

Now as we have Virtual machine ready with SQL server 2017, we can start with SharePoint Server 2019 installation.
1. Let’s first download the setup from
2. I have chosen ‘en-us\16.0.10711.37301_OfficeServer_none_ship_x64_en-us_dvd\officeserver_en-us.img’ installation language for downloading installation, its 3.8GB size.

Download SharePoint Server

3. Click Save to copy the disc image file to your computer.
4. Right click on the ‘officeserver_en-us.img’ file and select Mount option.


5. Navigate to the mounted drive.
6. Run splash.hta to launch the SharePoint Server 2019 Start page.
7. Click Install software prerequisites to launch the Microsoft SharePoint 2019 Products Preparation Tool.


8. Follow the instructions in the tool to complete the installation of the software prerequisites.


9. Select ‘Finish’ to restart the server and complete the installation of prerequisites.
10. After restart if the image file not mounted automatically then repeat step 4,5 and 6 to run the splash.hta file.
11. On the SharePoint Server 2019 Start page, click ‘Install SharePoint Server’ to launch Microsoft SharePoint Server 2019 Public Preview Setup.


12. When prompted, provide a product key. You can use the trial product key from article install instructions section. The trial period is 180 days. You can convert to a licensed installation at any time during the trial or after the trial has expired by entering the appropriate product key in Central Administration.


13. Sit back and relax to complete the installation.



14. After completing the setup SharePoint Product configuration wizard will be started.


15. Select ‘Yes’ at the following screen.


16. As we are creating new farm, select as below screen shot.


17. Select Next on below screen.


18. In next screen we need to provide DB server details and Database access account details.


19. After giving user details using which we have created the VM,I was getting following error “The specified user is a local account. Local accounts should only be used in stand alone mode.


20. I thought we need to create a SQL user and pass that to continue the setup.
21. Hence I connected to SQL server management studio.


22. I have created a new SQL user.


23. And granted all the roles to that account.


24. Now selected the newly created user also not helping me and giving same error as given in step no 19.
25. After that I have tried creating the new local user account and added that to Local administrator group and using those user in SQL. This also not helped me and I got stuck for some time.
26. After searching for the error we came across SP 2016 post when the solution was described to use the New-SPConfigurationDatabase cmdlet.


New-SPConfigurationDatabase -DatabaseName SharePoint_ConfigDB -DatabaseServer [ServerName] -AdministrationContentDatabaseName SharePoint_ContentDB -Passphrase (ConvertTo-SecureString [password] -AsPlaintext -Force) -FarmCredentials (Get-Credential) -localserverrole SingleServerFarm

27. Please read about at cmdlet New-SPConfigurationDatabase , I used ‘SingleServerFarm’ option for localserverrole parameter as I am installing on single server.
28. This command will take some time and create configuration database.
29. After successful completion run the SharePoint product configuration wizard again.


30. This time it got succeed and we are able to proceed.


31. Click Next to continue with configuration. And wizard will continue as following.



32. Now the final configuration task started and installation continued.


33. Installation success message shown as following.


34. Now we can able to access SharePoint central administration.


We can now free to create web application and site collection. Modern site templates are available at ‘Template selection’ step.

Hope this article will help to save some valuable time while setting up SharePoint 2019 preview.
Thanks for Reading.

SharePoint online / SharePoint 2013: Sharing variable values between search control and display templates

November 29, 2017 Leave a comment

Recently I came across to a scenario where I need to set the variable in control template and the value of the variable should be accessible in item template and vice versa.
I was showing some data in item templates and using third party pagination for displaying the search result, needed the value of pagination size which is available in control template.
I tried with normal JavaScript variable but due to the scoping in display template it was not available for me inside the item template.
Solution 1:
We can use Windows.variable which is nothing but global variable creation on the scope of the window object and hence will be accessible throughout the scope of windows object.
Control Template:

<!--#_ window.PageSize = "30"; _#-->

Item Template:

<!--#_ alert(window.PageSize); _#-->

Solution 2:
Another better alternative is to use the built-in ctx object which is already shared between the control and item display template.
Control Template:

<!--#_ ctx.PageSize = "30"; _#-->

Item Template:

<!--#_ alert(ctx.PageSize); _#-->

Happy learning.