Posts

Query String Builder V1

public static string BuildUrlWithQueryString ( string baseUrl, NameValueCollection parameters ) { var queryString = string .Join( "&" , parameters.AllKeys .Select(key => string .IsNullOrEmpty(parameters[key]) ? HttpUtility.UrlEncode(key) : $" {HttpUtility.UrlEncode(key)} = {HttpUtility.UrlEncode(parameters[key])} " )); return string .IsNullOrEmpty(queryString) ? baseUrl : $" {baseUrl} ? {queryString} " ; }
 <script type="text/javascript"> function uploadFileAsAttachment(itemId, fileInput) {   var file = fileInput.files[0];      if (file) {     var context = SP.ClientContext.get_current();     var web = context.get_web();     var list = web.get_lists().getByTitle("Your List Name");     var listItem = list.getItemById(itemId);          // Read the file data     var reader = new FileReader();          reader.onloadend = function (evt) {       if (evt.target.readyState == FileReader.DONE) {         // Create a new file creation information object         var attachmentInfo = new SP.AttachmentCreationInformation();         attachmentInfo.set_contentType(file.type);         attachmentInfo.set_fileName(file.name);         attachmentInfo.set_attachmentCon...
 <script type="text/javascript"> function uploadFile() {   var fileInput = document.getElementById("fileInput");   var file = fileInput.files[0];      if (file) {     var context = SP.ClientContext.get_current();     var web = context.get_web();     var list = web.get_lists().getByTitle("Your List Name");     var folder = list.get_rootFolder();          context.load(folder);          // Read the file data     var reader = new FileReader();          reader.onloadend = function (evt) {       if (evt.target.readyState == FileReader.DONE) {         // Create a new file creation information object         var fileInfo = new SP.FileCreationInformation();         fileInfo.set_url(file.name);         fileInfo.set_content(new SP.Base64EncodedBy...

Sample HTML

 <!DOCTYPE html> <html> <head>   <title>SharePoint Layout with Glassy Look</title>   <style>     body {       background-color: #800000; /* Maroon background color */       color: #FFFFFF; /* White text color */       font-family: Arial, sans-serif;       margin: 0;       padding: 0;     }     .container {       max-width: 960px;       margin: 0 auto;       padding: 20px;       background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white background */       box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); /* Glassy box shadow */     }     h1, h2, h3 {       margin: 0;     }     .content {       margin-top: 20px;     }   </style> </head> <body>   <div...

Retrieve List Item Details

 function retrieveListItemDetails(listName, itemId) {   // Get the current SharePoint context   var context = SP.ClientContext.get_current();   // Get the list   var list = context.get_web().get_lists().getByTitle(listName);   // Get the list item   var listItem = list.getItemById(itemId);   // Load the list item properties   context.load(listItem);   // Execute the query   context.executeQueryAsync(     function () {       // On success, retrieve the item values       var title = listItem.get_item('Title');       var description = listItem.get_item('Description');       // Concatenate the values into a query string parameter       var queryStringParam = 'title=' + encodeURIComponent(title) +         '&description=' + encodeURIComponent(description);       // Pass the query string parameter to another applicati...

Javascript function to populate from query string

 function populateFieldsFromQueryString() {   // Get the query string from the URL   const queryString = window.location.search;   // Check if there is a query string   if (queryString) {     // Remove the leading "?" character     const queryParams = queryString.substring(1);     // Split the query string into key-value pairs     const keyValuePairs = queryParams.split("&");     // Loop through the key-value pairs     keyValuePairs.forEach((pair) => {       // Split each pair into key and value       const [key, value] = pair.split("=");       // Decode the key and value (in case of URL encoding)       const decodedKey = decodeURIComponent(key);       const decodedValue = decodeURIComponent(value);       // Find the corresponding field in the document       const field = document.querySelecto...
 Concat(     GroupBy(         'CollectionName',         "IdentityColumn",         "GroupedData",         "NameColumn"     ),     If(         CountRows("GroupedData") = 1,         "GroupedData[@NameColumn]",         Concatenate(             "GroupedData[@NameColumn]",             ", ",             "GroupedData[@NameColumn]",             GroupedData,             ", "         )     ),     " " )
To convert a column of folder paths into a tree structure of rows, you can use a combination of Excel formulas and VBA code. Here are the steps to follow: Insert a new column to the right of the column with the folder paths. In the first cell of the new column, enter the formula =LEN(A1)-LEN(SUBSTITUTE(A1,"\","")) , where A1 is the first cell in the column with the folder paths. This formula calculates the number of backslashes in the folder path. Copy the formula down the entire column to calculate the number of backslashes in each folder path. Insert a new sheet in the workbook and name it "Tree". In the "Tree" sheet, create headers for the columns "Level 1", "Level 2", "Level 3", etc. up to the maximum number of levels in your folder paths. For example, if your folder paths have a maximum of 3 levels, create columns for "Level 1", "Level 2", and "Level 3". In the first cell of each co...
 async function getListItems(listUrl: string) {   const apiUrl = `${listUrl}/items?$top=5000`;   const items = [];   let skipToken = null;   do {     const url = skipToken ? `${apiUrl}&$skiptoken=${encodeURIComponent(skipToken)}` : apiUrl;     const response = await fetch(url, {       headers: {         Accept: "application/json;odata=nometadata"       }     });     const data = await response.json();     items.push(...data.value);     skipToken = data["@odata.nextLink"] ? data["@odata.nextLink"].split("&$skiptoken=")[1] : null;   } while (skipToken);   return items; } const listUrl = "https://<your-site-url>/_api/web/lists/getByTitle('<your-list-title>')" ; const items = await getListItems(listUrl); const filteredItems = items. filter ( item => { return filters. every ( filter => item[filter. property ] ...
Image
  How software helped world during the pandemic The COVID-19 pandemic has changed the way we work, study and socialize. In particular, it has accelerated the trend towards digitalization. Many organizations have had to adopt new technologies to stay afloat during these difficult times. Here, we take a look at how different software applications have helped people and businesses during the pandemic. How did software help during the pandemic? Software has helped the world in a number of ways during the pandemic. Perhaps most importantly, it has allowed people to stay connected when they otherwise would have been isolated. It has also been a valuable tool for research and data collection, helping to inform decision-makers about the best course of action to take. In addition, software has played a role in the development and distribution of vaccines and treatments. And it will continue to be an important part of the response to the pandemic, helping us to track the spread of the di...

SharePoint Spaces- Enable mixed reality feature in SharePoint

Image
Which pivotal feature gonna to make the major changes in the upcoming web technology? The answer is Mixed Reality, which will be the near future evolution in human, computer, and environment interaction in the technology world, and it is obvious that this revolution is going unlocks possibilities which cannot be imagine by  common users  at present. Mixed Reality feature will ensure that the SharePoint is reaching another milestone in the Web of Things (Web 4.0).Okay lets come to the point, Is really SharePoint providing Mixed Reality as a OOTB feature at present? yes, SharePoint released Mixed Reality as a OOTB feature called Spaces.  This feature is available as a preview in Modern sites. As  Microsoft suggested, communication site will be more suitable than team site. Since communication site has more screen space to work with, at the same time this feature is also possible with Team site. It is very easy to bring the feature into your site...

Customize Theme in SharePoint Online Portal

Image
Organizations can have a uniqueness to the sites in the intranet portal while each department or branch has a separate site. Most people wouldn’t like to change the colors completely in the theme as available in OOTB, instead, they would like to change few things on the page while it still looks like their original theme of the organization. Microsoft has brought in an option to implement the custom theme in SharePoint online. So this post talks about how can implement the theme customization in SharePoint Portal. Microsoft has provided an online generator to create a custom theme which helps site owners to select the color combination and verify instantly. Below screen shows how the generator looks like. https://aka.ms/themedesigner Instantly showing the changes in sample page which is available right after the color slider. After finalizing colors, you can export it in different ways as JS code, JSON and PowerShell Script. This article is going to explain the way yo...