Skip to content

Instantly share code, notes, and snippets.

#Parameters
$tenantUrl = Read-Host -Prompt "Enter tenant collection URL";
$dateTime = (Get-Date).toString("dd-MM-yyyy-hh-ss")
$invocation = (Get-Variable MyInvocation).Value
$directorypath = Split-Path $invocation.MyCommand.Path
$fileName = "SharedLinks-" + $dateTime + ".csv"
$ReportOutput = $directorypath + "\Logs\"+ $fileName
#Connect to PnP Online
#Parameters
$tenantUrl = Read-Host -Prompt "Enter tenant collection URL";
$dateTime = (Get-Date).toString("dd-MM-yyyy-hh-ss")
$invocation = (Get-Variable MyInvocation).Value
$directorypath = Split-Path $invocation.MyCommand.Path
$fileName = "SharedLinks_REST-" + $dateTime + ".csv"
$ReportOutput = $directorypath + "\Logs\"+ $fileName
# Ensure the logs folder exists
#Parameters
$tenantUrl = Read-Host -Prompt "Enter tenant collection URL";
$dateTime = (Get-Date).toString("dd-MM-yyyy-hh-ss")
$invocation = (Get-Variable MyInvocation).Value
$directorypath = Split-Path $invocation.MyCommand.Path
$fileName = "SharedLinks-" + $dateTime + ".csv"
$ReportOutput = $directorypath + "\Logs\"+ $fileName
#Connect to PnP Online
Connect-PnPOnline -Url $tenantUrl -Interactive
@reshmee011
reshmee011 / Query_Permissions_SharingLinks
Last active September 14, 2024 22:21
Query Permissions Unique Permissions Sharing links SharePoint Online PowerShell
@reshmee011
reshmee011 / StrippingHTML file
Last active December 28, 2017 07:21
Stripping HTML from text in SSRS reports
Public Function StripHTML(ByVal sInput As String) As String
IF sInput IsNot Nothing Then
IF(sInput <>"") Then
Dim objRegExp AS NEW System.Text.RegularExpressions.Regex("<(.|\n)+?>")
sInput = Replace(sInput, "<BR>", Chr(10))
sInput = Replace(sInput, "<br>", Chr(10))
sInput = Replace(sInput, "<br/>", Chr(10))
sInput = Replace(sInput,"&#160;", " ")
sInput = Replace(sInput, "<li>", "-")
BEGIN TRAN
if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#tmp_table_value') and xtype='U')
drop table #tmp_table_value
CREATE TABLE #tmp_table_value
([table_id] [int] NOT NULL,
[value_date] [datetime] NOT NULL,
[raw_value] [decimal](12, 6) NULL
)
@reshmee011
reshmee011 / deleteversions.ps1
Created April 22, 2017 10:46
Delete all list Item versions from site and sub sites using CSOM and PowerShell
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
Set-Location $PSScriptRoot
$pLoadCSOMProperties=(get-location).ToString()+"\Load-CSOMProperties.ps1"
. $pLoadCSOMProperties
Function DeleteVersionsFromLists($web, $versionCount)
{
# Set up key variables
$subscrName="<name of your Azure subscription>" -- "Visual Studio Premium with MSDN"
$rgName="<your resource group name>" -- "SharePoint-2013"
$locName="<the Azure location of your resource group>" -- "WestEurope"
$dnsName="<unique, public domain name label for the SharePoint server>" --"sp2013-app-01"
# Set the Azure subscription
Get-AzureRmSubscription -SubscriptionName $subscrName | Select-AzureRmSubscription
# Get the Azure storage account name
# Log in to Azure
Login-AzureRmAccount
# Set up key variables
$subscrName="<name of your Azure subscription>" -- "Visual Studio Premium with MSDN"
$rgName="<your resource group name>" -- "SharePoint-2013"
$locName="<the Azure location of your resource group>" -- "WestEurope"
$dnsName="<unique, public domain name label for the SQL server>" -- "sp2013-db-01"
# Set the Azure subscription
function GetWebPartByTitle()
{
param(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[Microsoft.SharePoint.Client.WebParts.WebPartDefinitionCollection] $webParts,
[Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)]
[string] $webPartTitle
)
if($webparts.Count -gt 0){
Write-Host "Looping through all webparts"