Thursday, October 12, 2023

How to disable grammarly in tinymce editor

I have tried data-gramm="false" and hiding it through CSS, but neither of these solutions has worked. If anyone can resolve this issue, please leave a comment.

Wednesday, October 11, 2023

How to disable related videos at the end of the embedded videos

Set rel parameter to 0 

https://www.youtube.com/embed/qU_djsolPkE?rel=0

In this case, rel=0 means that YouTube will not show related videos at the end of the embedded video. Setting rel=0 disables the display of related videos from other channels after the video playback is completed. If you were to set rel=1 instead, it would allow related videos to be shown.

This parameter is often used by website or content creators who want to prevent viewers from being distracted by other videos after watching the embedded video.

This parameter not working since 2018. See Notes below

YouTube Embedded Players and Player Parameters  |  YouTube IFrame Player API  |  Google for Developers



Tuesday, October 10, 2023

How to Create a Calendar Event Using Microsoft Graph API and C#

Microsoft Graph API is a powerful tool that allows developers to access a wide range of Microsoft 365 services, including Outlook and Calendar. In this blog post, we will walk you through the steps to create a calendar event using the Microsoft Graph API and C#. This integration can be incredibly useful for automating event scheduling and managing calendars within your applications.

Prerequisites

Before we dive into the code, you'll need the following:

  • Microsoft 365 Account: Ensure you have access to a Microsoft 365 account and have the necessary permissions to create calendar events.
  • Azure App Registration: Create an Azure App Registration to obtain the required client ID and client secret for authentication.
  • Visual Studio or Visual Studio Code: Use an IDE such as Visual Studio or Visual Studio Code with the necessary C# development tools installed.
  • Microsoft.Graph NuGet Package: Install the Microsoft.Graph NuGet package in your project to interact with Microsoft Graph API.

Step 1: Set Up Your Azure App Registratio

Navigate to the Azure portal and create a new App Registration and Note down the Application (client) ID, Tenant ID and generate a client secret. This information will be needed for authentication.

Step 2: Install Microsoft.Graph NuGet Package

In your C# project, install the Microsoft.Graph NuGet package using the package manager console or NuGet package manager in Visual Studio:

Step 3: Create GraphServiceClient

var clientSecretCredential = new ClientSecretCredential(tenantid, clientid, secret);

var _graphServiceClient = new GraphServiceClient(clientSecretCredential);

Step 4: Create a Calendar Event

Now that we have obtained the graphServiceClient, we can use it to create a calendar event using the Microsoft Graph API.

var newEvent = new Event

            {

                Subject = actionPlan.EventTitle,

                Start = new DateTimeTimeZone

                {

                    DateTime = actionPlan.EventStartTime.Value.ToString("o"),

                    TimeZone = TimeZoneInfo.Utc.Id

                },

                End = new DateTimeTimeZone

                {

                    DateTime = actionPlan.EventEndTime.Value.ToString("o"),

                    TimeZone = TimeZoneInfo.Utc.Id

                },

                Location = new Location

                {

                    DisplayName = actionPlan.EventLocation

                },


                Body = new ItemBody

                {

                    Content = notificationBody,

                    ContentType = BodyType.Html

                },


                Attendees = attendeeList,


                ResponseRequested = true


            };

var createdEvent = await graphServiceClient.Users[currentUser].Events.Request().AddAsync(newEvent);

Adjust the event details and date/time as needed for your specific use case.

Conclusion

You have now learned how to create a calendar event using the Microsoft Graph API and C#. Integrating Microsoft Graph API into your applications opens up a world of possibilities for automating and enhancing calendar management within your organization. Happy coding!

Wednesday, November 4, 2020

Authentication failed because remote party has closed the transport stream

This error message generally receive when you are try to send emails through TLS 1.2 or higher. To solve this add this line before send emails. 

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

Sunday, October 25, 2020

How to use CKEditor in a Bootstrap Modal

 I used CKEditor inside html and it worked fine, but when I use it inside bootstrap modal some features won't work correctly. Specially image resizing not working properly. 

Here how I solved this with this work around. Place this inside $(document).ready block. 

$.fn.modal.Constructor.prototype.enforceFocus = function () {
    var $modalElement = this.$element;
    $(document).on('focusin.modal', function (e) {
        var $parent = $(e.target.parentNode);
        if ($modalElement[0] !== e.target && !$modalElement.has(e.target).length
            // add whatever conditions you need here:
            &&
            !$parent.hasClass('cke_dialog_ui_input_select') && !$parent.hasClass('cke_dialog_ui_input_text')) {
            $modalElement.focus()
        }
    })
};

Thursday, October 22, 2020

SendGrid emails not working after disabled TLS 1.0

 Last month one of our client wanted to disable TLS 1.0 in server and they wanted to go with latest TLS 1.2.

After disabled this, the email wasn't working. To solve this I had to call this single line before call call send function.

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;


  



Monday, November 6, 2017

Unable to find manifest signing certificate in the certificate store

I got this message, when i move project source code to another machine.
To sole this, remove below tags from .csproj file

<manifestcertificatethumbprint>...</manifestcertificatethumbprint>
<manifestkeyfile>...</manifestkeyfile>
<generatemanifests>...</generatemanifests> 
<signmanifests>...</signmanifests>

I Built a New Kind of Number Puzzle Game (And You Can Play It Free)

 For a long time, I wanted to play a mobile puzzle game that felt genuinely strategic—something that required real brainpower, skipped the a...