Posts

define not working with spfx / sharepoint online

 usually when we use modern plugins you will see something like this in the top of the JS file: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SOMEPLUGINNAME=e()}(this,(function(){"use strict"; //more js code BUT you will see errors like "SOMEPLUGINNAME is not defined", "cannot find module", ect. the reason is that MS overrides so many things and "define" as well, and i am not sure why it fails. BUT all that code wants to find the the "Window" object as named above  globalThis So lets help him and change to  !function(t,e){(t="undefined"!=typeof globalThis?globalThis:t||self).SOMEPLUGINNAME=e()}(this,(function(){"use strict"; //more js code or even just  !function(t,e){ globalThis .SOMEPLUGINNAME=e() } BTW for adding all t

Host Angular app INSIDE C# Web Api 2 (as single app) (not .Net Core) and install in server (and browse from outside)

Image
Host Angular inside ANY C# / ASP.NET solution. Table of Content: Web Dev Tools List Create DB (ms-sql) Create API (c# webapi 2) + connect to DB Create Angular project  + connect to API Host the NgApp inside the API Install in Server + connect from internet 1. Web Dev Tools List The list of tools : they are all "Next,  Next, Next...", and they are all on google search, SSMS - Sql Server Management Tool - for SQL (also installs server) VS22 - Visual Studio 2022 Community - dont forget to check Asp.Net dev tools with .Net framewroks 4.6.1-4.8 VSC - Visual Studio Code NodeJS (version compatible to the angular version) Angular (your version) For server install - windows server (2022) with IIS 2. Create DB Open SSMS (type "SQL" in start) There, copy your server name (before click "Connect"): Create a DB and a Table (just right-click -> "New..." and give names) Make sure you have an "Id" columns that is key identity, by double-clicking the

3 Simple ways to retrieve generic SQL data with C# / WebAPI controller (using DataRow)

Image
Full Code in the end! :) Assuming you have some connection string: private static string ConnectionString = ConfigurationManager.AppSettings["myConnStrApp"]; And assuming we are using the simple "SqlDataAdapter", our Method will start with: using (SqlConnection conn = new SqlConnection(ConnectionString)) {       using (SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM " + tblname, conn)) {             DataSet ds = new DataSet("ds");             adp.Fill(ds); We have 2 generic options return (convert to) Json String build json object Lets 1st mention the "standard" way - by class model. That means we need to create a new C# class per sql table, and then create matching parsing mechanism, meaning that the rest of our method contains this (see more in the end): var rows = ds.Tables[0].Rows; for (int i = 0; i < rows.Count; i++) {     var r = rows[i];     t.Add(new TNG() {         Id = int.Parse(r["Id"].ToString()),        

PowerApps Patch new SharePoint list item with conditional / dynamically adding fields

Important   if you get an error that says: powerapps patch sharepoint list error the specified column "" does not exist the column with the most similar name is "" that would be because you use the column DisplayName instead of the InternalName Solution:  Set(oItem, {     Title:me.displayName,     EmpITref:{Id:meSP.ID, Value:meSP.Title},     EducationLevel:EducationLevel.SelectedText.Value,     CertCount:vis,     WorkYearsExp:WorkYearsExp.SelectedText.Value,     anythingElse:anythingElse.Text,     DigitalSignature:DigSign.Text }); If(vis<>0, Set( oItem, Patch (oItem, {     Cert1_x002d_OrgAd:cert1_orgAd.Text,      Cert1_x002d_Title: cert1_title.Text,     Cert1_x002d__x0023_:cert1_No.Text,      Cert1_x002d_GrantDate:cert1_grant.SelectedDate,     Cert1_x002d_exp_x002e_Date:cert1_exp.SelectedDate }))); If(vis=2, Set( oItem, Patch (oItem, {     Cert2_x002d_OrgAd:cert2_orgAd.Text,      Cert2_x002d_Title: cert2_title.Text,     Cert2_x002d__x0023_:cert2_No.Text,     

Share Folder to Multiple External Users one by onne - Power Automate (item created)

Image
 Scenario: there is a new SP sub-folder every day with some files. this needs to be shared to about 40 different emails daily. BUT with 2 exclusions: 1. sometimes we want these 35 emails, sometimes some other 38 emails. so every day we exclude a few emails, every day different ones. 2. we do not want the "clients" to know about one another, so no bulk sharing or just external link, only share 1 by 1. SOLUTION: 1. SPList for emails ("clients") 2. SP Library containing "main" folder, inside we create daily SP sub-folder with a name (usualy just the date like "25.8.23") 3. SPList for trigger the flow (power automate) on item created, getting from+archive for daily broadcast 4. flow for filtering out excluded emails, and sending 1 by 1 a share email. lets go 1. SPList for emails ("clients") really nothing other than new list, Title for "client name" and another text field for email 2. SP Library containing "main" folder,