Skip to main content

Posts

Using azure event gird with a function app

Introduction In this tutorial we will set up a simple azure event grid topic, with an function app as a subscriber to the topic. The function app will just log the messages, so we can se that it picked up the event. Setting things up First step is to create a resource group where we can add all the azure services we need az group create --name  myresourcegroup   --location norwayeast We need to set up a storage account that can be used bye the function app. az storage account create --name mystorageaccount --resource-group myresourcegroup --location eastus --sku Standard_LRS Now that we have a storage account we can make the function app. Here we will set it up to be able to run .Net 6 functions az functionapp create --name myFunctionApp --resource-group  myresourcegroup  --consumption-plan-location eastus --runtime dotnet --runtime-version 6.0 --functions-version 4 --storage-account  mystorageaccount...
Recent posts

Separate frontend 1: Trying to separate GUI layer and data business layer.

I have seen in some projects where I have been part of. The dependency injection is done in the presentation part of the application. That can be the API front or the GUI part like in a ASP.Net web application. The way this is done is to have some interfaces to separate the business from the data layers. Often by having the interfaces for them self in a separate project. Then the presentation layer references the business layer, interfaces and data layer, and connects it all together using dependency injection. This makes it easier to test, and change storage or parts of the application. As the injector can just inject new implementations of the interfaces.  But to me that feels like the presentation layer has two large responsibilities,  to present data and connect all the different parts together. What if you needed to change the presentation.  Then you would have to implement the injections also. You can't just switch out the presentation or add new ones. What if the o...

Fast way of opening vs code from windows explorer

I like to find thing using Windows Explorer. I'm used to it. Before in tools like Visual Studio you could only double click the solution file and you where ready to go. Bot in Visual Studio Code (Code) you need to open though Code or cmd. Before I used to find the project folder i Windows Explorer and then type " cmd " in the address field. Cmd would open and I typed " code . ". But then I would have to you two steps, and I would have a hanging  Cmd window each time I open a project. Yes i'm lazy one could just close the open ones, but still adding one more step. The solution for me was the fact that you can add arguments in the address filed in Windows Explorer. So when I typed ' cmd /c "code . " '  Code will open directly. Nice back to one step, and the best part Windows Explorer remebers the command. Solution: cmd /c "code ."
Java script for downloading an attachment in a based on seach used in display template.   getAttachements: function (siteUrl, listId, itemId) {            console.log("siteUrl " + siteUrl);            console.log("listId " + listId);            console.log("itemId " + itemId);                        doSpAction(function() {                console.log("doing sp action");                               var clientContext = new SP.ClientContext(siteUrl); //                      var list = cx.get_web().get_lists().getByTitle("Bestillinger");               var productList = clientContext.get_web().get_lists().getById(listId)...

Upload dokument jsom notes

Code I used to upload a document into a list based on search context in a displaytemplate  upLoadDocument: function(itemId, produkt) {                doSpAction(function(){                   var inputFile = document.getElementById(itemId + "upload");                   var btnUpLoad = $("#" + itemId + "btnupload");                   var fileNameSpan = $("#" + itemId + "filename");                   var uploadPnl = $("#" + itemId + "uploadPnl");                   var doUpload = $("#" + itemId + "doUpload");                                                       console.log(btnUpLo...

CSOM System Update that does not update minor version number

I was in a scenario where I had to do a add some data to a document list in a web job. My issue was that I could not find any system update method in the CSOM API. After searching it i found a blog post showing that one could just override the system fields, like Modified and Editor(Modified My). That seemed to work but that did not stop it form updating the version number of the document. This example will only work for minor unpublished version. I have not found a way to do this without a published version. There it will get a new minor version. The solution combines the use of adding Editor, and Modified with the use of the ValidateUpdateListItem metod. I found that one can set the item values on the item and just set one value in the form value list, then it will update all the fields. If one then set the "bNewDocumentUpdate" it will not update the version number if it is a minor version. So what i do is just get the values from the item before an update, then sets...