Wednesday 12 April 2023

SharePoint Classic Video Player

SharePoint Classic Video Player taken directly off backend SharePoint Classic, so it just works.


Add this to a script editor web part


Here is the code:

The yellow is the link location to the video

The pink in the link location to the preview image of the video


<div class="mediaPlayerContainer"><video class="mediaPlayerVideoObject" id="FilePreviewID-1-MediaPlayer" onloadstart="" poster="/_layouts/15/images/videopreview.png" width="350px" height="197px" data-init="1" controls=""><source src=https://mysite.sharepoint.com/SiteAssets/video.mp4 data-label="undefined" type="video/mp4"><a href="javascript:Silverlight.getSilverlight(&quot;2.0&quot;);" style="text-decoration: none;"><img src=http://go2.microsoft.com/fwlink/?LinkID=108181 alt="Get Microsoft Silverlight" style="border-style: none" data-themekey="#"></a></video><div class="mediaPlayerFullScreenEsc"><span></span></div><div class="mediaPlayerInitialPlayButton" style="display: none;"><a href="javascript:;" title="Play"><span></span></a></div><img src="/_layouts/15/images/hig_progcircle_loading24.gif" class="mediaPlayerLoadingIndicator" title="Buffering... Please wait" alt="Buffering... Please wait" data-themekey="#" style="display: none;"></div>

Tuesday 26 February 2019

2019 Modern SharePoint sites

I finally found the link (and the time) to create the new Modern SharePoint site templates. Woohoo! I just wanted to share with you the options and how they look.

There are 2 options:

  • Communication Site
  • Team Site


1.       The Communication Site has 3 options:

1.       Topic
2.       Showcase
3.       Blank

Looks funky and the first two option look quick different from each other. You can't create Communication subsite, so if you do create some kind of team site, the look and feel (and especially the navigation) doesn't match. 

2.       The Teams Site has only 1 options

This Team site is not to be confuse the Team site (OG), this is the Modern Team site. “Modern” being the new styling word to describe this new look and feel.

I personally don’t like this one so much, the global navigation menu isn’t there, and if you force it on, it looks bad. Have a look, and you decide. You are welcome to make changes, these are just for use to play with.

Screenshots

Communication Topic Site

Communication Showcase Site

Communication Blank Site

Team Site



Enjoy J

Wednesday 14 June 2017

Mapped crawled properties for "URL"

Getting the right URL information from the "URL" column within your SharePoint Content Search Web Part (CSWP). This would be the OOTB (Out of the Box) SharePoint "URL" column.

Mapped crawled properties for "URL"

ows_URL

results = {URL}
example = http://www.google.com

ows_q_URLH_URL

results = {URL}, {Description}
example = http://www.google.com, Google

RefinableString for Title

Just had some fun and games with the SharePoint Content Search Web Part (CSWP). I create some content, list and pages, all with there own content type. I was able to view the column "Title" content in the CSWP display, but not able to Sort by "Title" or have it as a Refiner.

So...
I used one of the RefinableString Managed Property. It was tricky to figured out which Mapped crawled property was the correct "Title". These are the ones that worked for me, for my current project.

Mapped crawled property for:
List - Basic:displaytitle
Page - ows_Title

Wednesday 14 October 2015

SharePoint Permission Matrix generated by PowerShell

I found the most awesome PowerShell script which generates a csv of all the permission access within a SharePoint site. It works so well.

One of the biggest issues in SharePoint, is access. Making sure the right people have the right access to the right things, and more importantly the wrong people don't have access. But SharePoint doesn't give you a good overview of this information. This is why this script is so nice. Its shows, who has access, and where, and with what level.

Original Article from Microsoft SharePoint TechNet:
http://social.technet.microsoft.com/wiki/contents/articles/14242.sharepoint-2010-export-all-unique-permissions-from-site-collection-using-powershell.aspx

How to get it to work:

  1. Save the script as a PowerShell script, example: CreatePermissionMatrix.ps1
  2. Goto the SharePoint Server.
  3. Create a folder, example: C:\PermissionLog
  4. Copy the script in here.
  5. Open "SharePoint Management Shell", as Administrator.
  6. Run the PowerShell script, example: . C:\PermissionLog\CreatePermissionMatrix.ps1
  7. The script will then ask for the SharePoint site URL, you want to report on.
  8. The script will then ask for the location, where the csv file will be generated, example: C:\PermissionLog
  9. Script Done :)
  10. Then you can go a retrieve the csv file.
  11. It will show: Who has access, and where, and with what level

PowerShell Script:

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin "Microsoft.SharePoint.PowerShell" 


$properties=@{SiteUrl='';SiteTitle='';ListTitle='';ObjectType='';ObjectUrl='';ParentGroup='';GroupOwner='';MemberType='';MemberName='';MemberLoginName='';JobTitle='';Department='';RoleDefinitionBindings='';};
$Permissions=@(); 

$UserInfoList=""; 

$RootWeb=""; 

$SiteCollectionUrl = Read-Host "Enter a Site Collection Url"; 

$ExportFileDirectory = Read-Host "Enter the Directory Path to create permissions export file";
if(Test-Path $ExportFileDirectory){
$spAssgn = Start-SPAssignment;
Get-SPSite $SiteCollectionUrl -AssignmentCollection $spAssgn|Get-SPWeb -limit ALL -AssignmentCollection $spAssgn|%{
$web = $_; 



#Root Web of the Site Collection 

if($web.IsRootWeb -eq $True){ 

$RootSiteTitle = $web.Title; 

$RootWeb = $web; 

$UserInfoList = $RootWeb.GetList([string]::concat($web.Url,"/_catalogs/users"));

$siteUrl = $web.Url; 

$siteRelativeUrl = $web.ServerRelativeUrl; 

Write-Host $siteUrl -Foregroundcolor "Red"; 

$siteTitle = $web.Title; 



#Get Site Level Permissions if it's unique 

if($web.HasUniqueRoleAssignments -eq $True){ 



$web.RoleAssignments|%{ 

$RoleDefinitionBindings=@(); 



$_.RoleDefinitionBindings|%{ 

$RoleDefinitionBindings += $_.Name; 






$MemberName = $_.Member.Name; 

$MemberLoginName = $_.Member.LoginName; 

$MemberType = $_.Member.GetType().Name; 

$GroupOwner = $_.Member.Owner.Name; 



if($MemberType -eq "SPGroup"){ 



$JobTitle="NA"; 

$Department="NA"; 



$permission = New-Object -TypeName PSObject -Property $properties; 

$permission.SiteUrl =$siteUrl; 

$permission.SiteTitle = $siteTitle; 

$permission.ListTitle = "NA"; 

$permission.ObjectType = "Site"; 

$permission.ObjectUrl = $siteRelativeUrl; 

$permission.MemberType = $MemberType; 

$permission.ParentGroup = $MemberName; 

$permission.GroupOwner = $GroupOwner; 

$permission.MemberName = $MemberName; 

$permission.MemberLoginName = $MemberLoginName; 

$permission.JobTitle = $JobTitle; 

$permission.Department = $Department; 

$permission.RoleDefinitionBindings = $RoleDefinitionBindings -join ","; 





$Permissions +=$permission; 



#Expand Groups 

$web.Groups[$MemberName].Users|%{ 



$JobTitle="NA"; 

$Department="NA"; 



try{ 

$userinfo = $UserInfoList.GetItemById($_.ID); 

$JobTitle=$userinfo["JobTitle"]; 

$Department=$userinfo["Department"]; 


catch{ 




$permission = New-Object -TypeName PSObject -Property $properties; 

$permission.SiteUrl =$siteUrl; 

$permission.SiteTitle = $siteTitle; 

$permission.ListTitle = "NA"; 

$permission.ObjectType = "Site"; 

$permission.ObjectUrl = $siteRelativeUrl; 

$permission.MemberType = "SPGroupMember"; 

$permission.ParentGroup = $MemberName; 

$permission.GroupOwner = $GroupOwner; 

$permission.MemberName = $_.DisplayName; 

$permission.MemberLoginName = $_.UserLogin; 

$permission.JobTitle = $JobTitle; 

$permission.Department = $Department; 

$permission.RoleDefinitionBindings = $RoleDefinitionBindings -join ","; 



$Permissions +=$permission; 





elseif($MemberType -eq "SPUser"){ 



$JobTitle="NA"; 

$Department="NA"; 



try{ 

$userinfo = $UserInfoList.GetItemById($_.ID); 

$JobTitle=$userinfo["JobTitle"]; 

$Department=$userinfo["Department"]; 


catch{ 




$permission = New-Object -TypeName PSObject -Property $properties; 

$permission.SiteUrl =$siteUrl; 

$permission.SiteTitle = $siteTitle; 

$permission.ListTitle = "NA"; 

$permission.ObjectType = "Site"; 

$permission.MemberType = $MemberType; 

$permission.ObjectUrl = $siteRelativeUrl; 

$permission.ParentGroup = "NA"; 

$permission.GroupOwner = "NA"; 

$permission.MemberName = $MemberName; 

$permission.MemberLoginName = $MemberLoginName; 

$permission.JobTitle = $JobTitle; 

$permission.Department = $Department; 

$permission.RoleDefinitionBindings = $RoleDefinitionBindings -join ","; 



$Permissions +=$permission; 








#Get all Uniquely secured objects 

$uniqueObjects = $web.GetWebsAndListsWithUniquePermissions(); 



#Get uniquely secured Lists pertaining to the current site 

$uniqueObjects|?{$_.WebId -eq $web.Id -and $_.Type -eq "List"}|%{ 



$listUrl = ($_.Url); 

$list = $web.GetList($listUrl); 



#Exclude internal system lists and check if it has unique permissions 

if($list.Hidden -ne $True){ 



Write-Host $list.Title -Foregroundcolor "Yellow"; 

$listTitle = $list.Title; 

#Check List Permissions 



if($list.HasUniqueRoleAssignments -eq $True){ 



$list.RoleAssignments|%{ 



$RoleDefinitionBindings=""; 

$_.RoleDefinitionBindings|%{ 

$RoleDefinitionBindings += $_.Name; 




$MemberName = $_.Member.Name; 

$MemberLoginName = $_.Member.LoginName; 

$MemberType = $_.Member.GetType().Name; 

$JobTitle="NA"; 

$Department="NA"; 



if($MemberType -eq "SPUser"){ 

try{ 

$userinfo = $UserInfoList.GetItemById($_.ID); 

$JobTitle=$userinfo["JobTitle"]; 

$Department=$userinfo["Department"]; 


catch{ 





$permission = New-Object -TypeName PSObject -Property $properties; 

$permission.SiteUrl =$siteUrl; 

$permission.SiteTitle = $siteTitle; 

$permission.ListTitle = $listTitle; 

$permission.ObjectType = $list.BaseType.ToString(); 

$permission.ObjectUrl = $listUrl; 

$permission.ParentGroup = "NA"; 

$permission.GroupOwner = "NA"; 

$permission.MemberType=$MemberType; 

$permission.MemberName = $MemberName; 

$permission.MemberLoginName = $MemberLoginName; 

$permission.JobTitle = $JobTitle; 

$permission.Department = $Department; 

$permission.RoleDefinitionBindings = $RoleDefinitionBindings -join ","; 



$Permissions +=$permission; 





if($list.BaseType -eq "DocumentLibrary"){ 



#Check All Folders 

$list.Folders|%{ 

$folderUrl = $_.Url; 



if($_.HasUniqueRoleAssignments -eq $True){ 



$_.RoleAssignments|%{ 

$RoleDefinitionBindings=""; 



#Get Permission Level against the Permission 

$_.RoleDefinitionBindings|%{ 

$RoleDefinitionBindings += $_.Name; 




$MemberName = $_.Member.Name; 

$MemberLoginName = $_.Member.LoginName; 

$MemberType = $_.Member.GetType().Name; 



$JobTitle="NA"; 

$Department="NA"; 



if($MemberType -eq "SPUser"){ 

try{ 

$userinfo = $UserInfoList.GetItemById($_.ID); 

$JobTitle=$userinfo["JobTitle"]; 

$Department=$userinfo["Department"]; 


catch{ 





$permission = New-Object -TypeName PSObject -Property $properties; 

$permission.SiteUrl =$siteUrl; 

$permission.SiteTitle = $siteTitle; 

$permission.ListTitle = $listTitle; 

$permission.ObjectType = $list.BaseType.ToString(); 

$permission.ObjectUrl = $folderUrl; 

$permission.MemberType = $MemberType; 

$permission.ParentGroup = "NA"; 

$permission.GroupOwner = "NA"; 

$permission.MemberName = $MemberName; 

$permission.MemberLoginName = $MemberLoginName; 

$permission.JobTitle = $JobTitle; 

$permission.Department = $Department; 

$permission.RoleDefinitionBindings = $RoleDefinitionBindings -join ","; 



$Permissions +=$permission; 






#Check All Items 

$list.Items|%{ 



$fileUrl = $_.File.Url; 

$file=$_.File; 

if($_.HasUniqueRoleAssignments -eq $True){ 



$_.RoleAssignments|%{ 

$RoleDefinitionBindings=""; 

$_.RoleDefinitionBindings|%{ 

$RoleDefinitionBindings += $_.Name; 




$MemberName = $_.Member.Name; 

$MemberLoginName = $_.Member.LoginName; 

$MemberType = $_.Member.GetType().Name; 

$JobTitle="NA"; 

$Department="NA"; 



if($MemberType -eq "SPUser"){ 

try{ 

$userinfo = $UserInfoList.GetItemById($_.ID); 

$JobTitle=$userinfo["JobTitle"]; 

$Department=$userinfo["Department"]; 


catch{ 





$permission = New-Object -TypeName PSObject -Property $properties; 

$permission.SiteUrl =$siteUrl; 

$permission.SiteTitle = $siteTitle; 

$permission.ListTitle = $listTitle; 

$permission.ObjectType = $file.GetType().Name; 

$permission.ObjectUrl = $fileUrl; 

$permission.MemberType=$MemberType; 

$permission.MemberName = $MemberName; 

$permission.MemberLoginName = $MemberLoginName; 

$permission.JobTitle = $JobTitle; 

$permission.Department = $Department; 

$permission.RoleDefinitionBindings = $RoleDefinitionBindings -join ","; 



$Permissions +=$permission; 









if($_.IsRootWeb -ne $True){ 

$_.Dispose(); 



#Dispose root web 

$RootWeb.Dispose(); 

Stop-SPAssignment $spAssgn;
$exportFilePath = Join-Path -Path $ExportFileDirectory -ChildPath $([string]::Concat($RootSiteTitle,"-Permissions.csv"));
$Permissions|Select SiteUrl,SiteTitle,ObjectType,ObjectUrl,ListTitle,MemberName,MemberLoginName,MemberType,JobTitle,Department,ParentGroup,GroupOwner,RoleDefinitionBindings|Export-CSV -Path $exportFilePath -NoTypeInformation;
}
else{
Write-Host "Invalid directory path:" $ExportFileDirectory -ForegroundColor "Red";
}

Monday 15 June 2015

Content Search Query rules to find all Sub Sites within the Current Site

Query:

contentclass:STS_Web 
Path:{Site.URL} 
Site<>{Site.URL}

How-to:

  1. This rule will only show sites. At this stage it shows all the sites across the whole environment.
  2. This rule will limit the results to sites with the current site. This also include the top level site.
  3. This rule removed the top level site, thus only showing the sub sites. 
  4. This rule removed the top level site, thus only showing the sub sites.