Skip to content

Instantly share code, notes, and snippets.

View rajivrajvat's full-sized avatar
🎯
Focusing

RAJIV RAJVAT rajivrajvat

🎯
Focusing
View GitHub Profile
@rajivrajvat
rajivrajvat / gist:5f81b8e9498f03f363dce944bc809b66
Created January 22, 2025 03:03
How to hide and unhide the library and list in SharePoint of site content [Jan- 2025]
Connect-SPOService -url https://domainname-admin.sharepoint.com
#Config Variables
$SiteURL = "https://Crescent.sharepoint.com/Sales"
$ListName ="AppConfig"
#Connect PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#SharePoint Online Hide a List
@rajivrajvat
rajivrajvat / .htaccess
Created August 24, 2023 17:22
please save the file with .htaccess and put this file along with all html file
#remove html file to extension http://bizview.in/index.html
# to http://bizview.in/index
RewriteEngine On
# Remove .html extension from the URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.html\ HTTP/
RewriteRule ^(.+)\.html$ http://bizview.in/$1 [R=301,L]
# Add .html to the URL internally
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
@rajivrajvat
rajivrajvat / Welcome MSG on your SharePoint Site!
Created August 20, 2023 07:04
Code of modern Script editor for sharepoint site which show welcome msg on your website Good Morning, Good After Noon and Good Evening msg.
h1 id="greeting" style="font-size:24px; margin:0px;"></h1>
<script>
//Get the current Display Name
const displayName = _spPageContextInfo.userDisplayName;
// Get the current date and time
const currentDate = new Date();
// Get the current hour from the current date
const currentHour = currentDate.getHours();
@rajivrajvat
rajivrajvat / Welcome MSG on your website!
Created August 20, 2023 07:01
The code of HTML, CSS and Javascript for response on welcome MSG on your web.
<style>
.greeting-container {
text-align: left;
}
#greeting {
font-size: 24px;
margin: 0;
@rajivrajvat
rajivrajvat / Restrict your code for Inspect & Copy2
Created August 18, 2023 07:55
Restrict your code for inspect and copy from your website.
<script type="text/javascript">
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
document.addEventListener('keydown', function(e) {
if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) {
e.preventDefault();
}
});
@rajivrajvat
rajivrajvat / Restrict your code for Inspect & Copy;
Created August 18, 2023 07:53
Restrict your code for inspect and copy from your website. [Desktop & Android Mobile]
<script type="text/javascript">
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
document.addEventListener('copy', function(e) {
e.preventDefault();
});
document.addEventListener('cut', function(e) {
@rajivrajvat
rajivrajvat / gist:a203f234f49175613adc7022d6c5d296
Created August 15, 2023 08:25
Hide your code on your website by mouse click and keyboard click || 15/08/2023
</script>
<script>
// JavaScript code
// Disabling right-click
document.addEventListener("contextmenu", function(e) {
e.preventDefault();
});
// Disabling F12 key and Ctrl+Shift+I
document.onkeydown = function(e) {
@rajivrajvat
rajivrajvat / Excel to SP List PowerShell Script
Created February 9, 2023 16:25
To Update Excel Data to SharePoint List data through PowerShell Scripting.
$User = "Rajivrao@0pqwz.onmicrosoft.com"
$Password = ConvertTo-SecureString "Rajeew@upi91" -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PSCredential ($User, $Password)
$SiteURL = "https://0pqwz.sharepoint.com/sites/sanyojika/"
$ListName = "ExportList"
$FilePath = "https://0pqwz.sharepoint.com/sites/sanyojika/Shared%20Documents/Employee%20Sample%20Data.xlsx"
Connect-PnPOnline -Url $SiteURL -Credentials $Credentials
if (Test-Path $FilePath)
{
Import-PnPExcelData -Path $FilePath -ListName $ListName
@rajivrajvat
rajivrajvat / SharePoint Rest API Endpoints
Created February 5, 2023 07:08
SharePoint REST API has a large number of endpoints that allow you to interact with SharePoint data. Some of the common endpoints include:
Sites - /_api/web/sites - Access information about the SharePoint sites in your organization.
Lists - /_api/web/lists - Access information about the lists in a site.
List Items - /_api/web/lists/getbytitle('list_title')/items - Access specific items in a list.
Users - /_api/web/siteusers - Access information about users in a site.
Content Types - /_api/web/contenttypes - Access information about the content types in a site.
Fields - /_api/web/lists/getbytitle('list_title')/fields - Access information about the fields in a list.
Folders - /_api/web/lists/getbytitle('list_title')/folders - Access information about the folders in a document library.
Files - /_api/web/lists/getbytitle('list_title')/files - Access information about the files in a document library.Views - /_api/web/lists/getbytitle('list_title')/views - Access information about the views in a list.
Taxonomy - /_api/web/taxonomy - Access information about the taxonomy term sets in a site.
Permissions - /_api/web/lists/getbytitle('list_title')/roleas
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"hideColumnHeader": true,
"hideSelection": true,
"rowFormatter": {
"elmType": "div",
"style": {
"flex-wrap": "wrap",
"margin-bottom": "25px"
},