SPFx CommandSet check if the selected row is a File or Folder

Check if the selected Row is Folder or File this is the Code Snippet
this.context.listView.selectedRows?.length === 1 && this.context.listView.selectedRows[0].getValueByName(“FSObjType”) ===”0″

Please check if you have a selected Row

Continue reading “SPFx CommandSet check if the selected row is a File or Folder”

Image Manipulation in dotnet core and Azure App Service (Linux)

I have used every time “system.drawing.common” and it works as expected on my Windows machine. Publish this web application on Windows-based Azure App Service everything works great.

After some while, I want to use this part in an Azure App-Service, but on Linux and it does not work 😦

This was the Exception

System.TypeInitializationException: The type initializer for 'Gdip' threw an exception

System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies

At this time I was shocked because I hadn’t expected this.

What options I had:

  1. switch back to windows
  2. Host the app in Linux docker and add this package
  3. use an Alternative Libary

Option 1 was not an option, because I like running this code on Linux.

So I tried the 2nd option Add docker-compose to Visual Studio and I got the same error because it’s based on docker image “microsoft/dotnet:runtime” and there is also the libraries missing

libc6-dev libgdiplus libx11-dev

At this point, I did not want to generate an Azure Container Registry or search on Github. I like the easy deployment in Azure and I want to use it as PAAS.

I know Azure App Service for Linux is a docker container based on “TODO”, but I prefer the basic Azure Services because Microsoft makes a great job to run the Infrastructure and it is cheaper 🙂

So I looked at alternatives i found SixLabors/ImageSharp  and i tried it. After 20 min all System.drawing.common was removed and replaced with the new one.

and it worked as expected.

Conclusion:

Linux and Windows are different.

I will never say again:

It’s dotnet core it will run on Linux and windows

because it’s not every time true.

But for the next project, I would do it in the same way, because I look for a library first  from the Framework creator


Drag and Drop in React (SPFx)

Drag and Drop in React (SPFx)

How to make a Control in React to be able to move HTML items to a drop-zone.

A lot of components and Helpers can do the work for you, but only some support IE11. Maybe you ask, why should I support IE 11? My answer is Microsoft support the IE11 in SharePoint Online, so you should also support this browser even you don’t like it.

In this post, I want to start with the basics of dragging support in a Browser.

Continue reading “Drag and Drop in React (SPFx)”