javascript – Nested Group By with Rest API in sharepoint online

I have a sharepoint list and where in initially it returns results in JSON array like below
enter image description here

Below is the code for the same

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
getItems();
        
});


function getItems() {

var filter7Day = new Date(new Date().setDate(new Date().getDate() - 7));

console.log(filter7Day.toISOString().split('T', 1)(0));

var filter7date ='2021-02-28T08:00:00Z';
        var listOfObjects = ()
    var listurl = _spPageContextInfo.webServerRelativeUrl+"/_api/Web/Lists/GetByTitle('Products')/Items?$select=Title,ProducedTons,Date,Plant/ID,Plant/Title,Grade/ID,Grade/Title&$expand=Plant/Title,Grade/Title&$filter=Date ge datetime'" + filter7Day.toISOString().split('T', 1)(0)+"T08:00:00Z'&$orderby=Plant&$top=5000";
    
$.ajax({ 
            cache: true,
            type: "GET",
            async: false,
            dataType: "json",
             headers: { "Accept": "application/json; odata=verbose" },
            url: listurl,
            success: function (data) {
                var results = data.d.results;
                //console.log(results);
                
            for (var key in results){   
    var singleObj = {};
    singleObj('title') = results(key).Plant.Title;
    singleObj('date') = results(key).Date.split('T', 1)(0);
    singleObj('producedTons') = results(key).ProducedTons;
    listOfObjects.push(singleObj);
}     

var TitleGroup = _.groupBy(listOfObjects, element => element.title)
console.log(TitleGroup);
var listOfObjects1 = ();
});
    
}

        

now i want to do a nested if Group by i.e with date

if 2 dates are same i wan’t to add those produced tons.

for example

in Lamesa product for date (2021-03-02) produced tons were 11516,963 so i want to sum both 1156+963=12479 for date (2021-03-02)

Excel 2010 issue in Sharepoint 2013 – We are sorry we cant open your work book

Workbooks that are protected (encrypted with password protection) cannot be viewed in a browser window.

In an on-premises environment where you’re using Excel Services or Excel Web App, protected worksheets cannot be viewed in a browser window.

To remove protection, open the workbook in the Excel on the desktop.

Besides, save your file as .xlsx format and compare the results.

Differences between using a workbook in the browser and in Excel for your reference:

https://support.office.com/en-us/article/Differences-between-using-a-workbook-in-the-browser-and-in-Excel-F0DC28ED-B85D-4E1D-BE6D-5878005DB3B6

PowerShell SharePoint Online CSOM Delete Versions

check this one

(System.Reflection.Assembly)::LoadWithPartialName("Microsoft.SharePoint.Client")
(System.Reflection.Assembly)::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

$password = Read-Host -Prompt "Enter password" -AsSecureString
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("userID@yourtenant.com", $password)

$siteUrl = "https://yourtenant.sharepoint.com/sites/yoursitecollection"
$context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$context.Credentials = $credentials


$fileUrl = "/sites/yoursitecollection/path_to_file/filename";
$versions = $context.Web.GetFileByServerRelativeUrl($fileUrl).Versions;

$context.Load($versions)
$context.ExecuteQuery()

for($i=10;$i -lt $versions.Count-10; $i++) 
{
    $versions($i).DeleteObject()
    $context.ExecuteQuery()
}

https://stackoverflow.com/questions/30231132/how-do-i-delete-version-history-files-in-sharepoint-online

Create entry limitations on SharePoint 2013 Calendar

Date fields do not have a minimum or maximum date property (like numbers).

Depending on your requirements you could probably do something with the validation property.
An example where someone posted an answer to validate the end date not being later than 30 days after the start date: date column validation

more info on date validations:
https://social.technet.microsoft.com/Forums/office/en-US/b4a57b7c-0938-42d8-96f6-f7e6ef21876d/custom-validation-in-sharepoint-2010-list-for-datetime-columns?forum=sharepointgeneralprevious

Formulas

  • You can only compare column values to one another in a list level validation.
  • A validation formula at the column level cannot include any other columns besides itself. For example, (Column1)>(Column2) is an invalid
    formula and SharePoint will not allow it to be used at the column
    level. In this case, you want to use list-level validation.
  • There is only one formula available at the list level.
  • The formula syntax is similar to that used in Calculated Columns

There are a few dozen functions available – I have not tried every
one. One interesting thing to note is that SharePoint 2010 would not
allow me to use the TODAY function, even when validating a Date field.
(DateColumn)>TODAY is not a valid validation formula.

The validation is effective for every user. If you want to make a difference per user (so user x gets date 1-3 and user y gets date 4-6) this will be much harder.

If the validation property won’t meet your requirements, perhaps Javascript can help you.

Javascript- Do something on date change in Datetime field- Newform.aspx https://social.technet.microsoft.com/Forums/sharepoint/en-US/3e7f06a8-2850-4f8b-966c-ade15667d588/javascript-do-something-on-date-change-in-datetime-field-newformaspx

sharepoint online – Is it possible to add Rich Text to a Document Set

1) Create a rich text site column (I named it testrichtext) as below from

https://sitecollectionurl/_layouts/15/mngfield.aspx

enter image description here

2) Now, go to your document library > settings > Click on your document set content type as below:

enter image description here

3) Now click on add from existing site or list columns. Add the testrichtext column.

enter image description here

4) Now create a new Document set and add your html description to it as below:

enter image description here

5) It could be possible that your html tags might be removed. But from the document set home page, click on edit properties and then the Rich text description will be displayed as below:

enter image description here

6) Now the home page is showing the correct html text.

enter image description here

Also have checked in the developer tools that it is indeed rich text.

enter image description here

sharepoint online – JSON – how to highlight duplicated items in a specific column?

ID column should always be updated by code or it should be autgenerated to reduce the duplication.

Currently JSON Formatter only work with formation and changing the layout of data.

But Still if you want check the dublicate value and highlight it. Customization is required.

In order to fullfill this requirment you have to use SharePoint Extension – Field Customizer and in item level you can build your logic.

caml query – using SSRS to generate a report based on a Calendar in Sharepoint 2013

We use the calendar in SP2013 to collect information when a user is away on holiday and when there will be any visitors. It works fine as a calendar but now struggling to generate a report in SSRS to show all the days when on holiday.

Example; this is what calendar looks like in SP2013

enter image description here

I am struggling to show all the consecutive days from Friday 03/02/2017 until 17/02/2017.
In this case, the Reports is just pulling the start date =Fields!Start_Time.Value

enter image description here

enter image description here

As you can see, from the result above, it does not show all the consecutive days but only the start time. Yes, you may say “…well you specified to show from the start time” but my question is here how to modify it so it shows HOLIDAY on all the dates relative to the start & end date.

Any ideas / suggestions?

The SSRS Query Type is as following:

<RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ListName>Staff Movements</ListName>
  <ViewFields>
    <FieldRef Name="Title" />
    <FieldRef Name="Location" />
    <FieldRef Name="EventDate" />
    <FieldRef Name="EndDate" />
    <FieldRef Name="Category" />
    <FieldRef Name="User" />
    <FieldRef Name="Department" />
    <FieldRef Name="Position" />
    <FieldRef Name="Visitors_x0020_Name" />
    <FieldRef Name="Visitors_x0020_Business" />
    <FieldRef Name="Visitors_x0020_purpose" />
    <FieldRef Name="Visitors_x0020_Visiting" />
    <FieldRef Name="Created" />
  </ViewFields>
</RSSharePointList>

error: server side activities have been updated you need to restart sharepoint designer

You need to install the January 12, 2016, update for SharePoint Designer 2013 (KB3114337). it fixes that issue:

When you try to create a SharePoint 2013 workflow in SharePoint Designer 2013 on a computer that has Microsoft.Activities.dll installed, you receive the following error message:
Server-side activities have been updated. You need to restart SharePoint Designer to use the updated version of activities.

Before installing this package you must first install the prerequisite Microsoft SharePoint Designer 2013 Service Pack 1.

https://support.microsoft.com/en-us/help/3114337/january-12–2016–update-for-sharepoint-designer-2013-kb3114337

powershell – Property ‘SetShowInEditForm’ cannot be found on this object; make sure it exists and is settable.- SharePoint Online

I’m trying to make a field in Edit mode hidden by using this code below :-

$web = $context.Web
$site = $context.Site 
$list = $web.Lists.GetByTitle("Test List");

$fields = $list.Fields("TestHidden");

# Controls Field in Edit Form
$fields.SetShowInEditForm = $false;
$fields.Update();
$list.Update();

$context.ExecuteQuery();

But i’m getting the error:- Property ‘SetShowInEditForm’ cannot be found on this object; make sure it exists and is settable.- SharePoint Online

Any ideas what am i missing?

spfx – SharePoint Online Custom modern page Footer using Application Customizer

We are creating a custom footer though SPFx Application Customizer for modern sharepoint pages. But our requirement on the Footer is to show the footer with a increased height. Once we deployed the customizer the Body of the page is not fully displayed. The footer is getting freeze in the screen and the rest of the body content needed to navigate via vertical scrolls. The code block to set the footer is mentioned below.

 let bottomPlaceholder: PlaceholderContent = this.context.placeholderProvider.tryCreateContent(PlaceholderName.Bottom);

    if (bottomPlaceholder) {
      ServiceManagerStatic.getService().getFooterContent("").then((footer)=>{
        console.log(footer);
        bottomPlaceholder.domElement.innerHTML = footer;
      }).catch((err)=>{

      });    
    return Promise.resolve();

Ideally the Footer should be placed in the bottom of the page not in the bottom of the screen. Is there a solution to apply this footer in bottom of the page so that it won’t affect the contents of the page?