CHUVASH.eu

CHunky Universe of Vigourous Astonishing SHarepoint :)

Tag Archives: spo

Listing all renamed sites in SharePoint Online

When you rename a site, a new site is REDIRECTSITE#0, you can get all the sites of that type by running

Get-SPOSite -Template REDIRECTSITE#0

Please consider some caveats with renaming a site url

Automatically detect new sites in SharePoint Online

Original image by William Warby. https://www.flickr.com/photos/wwarby/16414155179/in/photostream/

Sites in SharePoint are created all the time, not only for SharePoint, but also as storage for Yammer, Teams, Planner and other services in Microsoft 365. There are ways to keep track of them, but the ability to automatically detect a new site creation is quite appealing. Automatic detection means a trigger of a Power Automate (Flow) or a Logic App.

There are a few blog posts that exactly describe how you can detect when a new site is created in SharePoint Online:

The provided blog posts are great how-tos, I am not giving you a new how-to for that, I’d like to reason about that solution.

The solution for automatic detection of new sites

Power Automate and Logic Apps can listen to new items in SharePoint. There is a list in the admin site (tenant-admin.sharepoint.com) that has SharePoint Sites as list items, its name is DO_NOT_DELETE_SPLIST_TENANTADMIN_ALL_SITES_AGGREGATED_SITECOLLECTIONS.

That’s it, in essence, it’s just setting up a new flow with “When an item is created in SharePoint” as a trigger, and you have thousands business scenarios you could implement, but let’s dig a little bit deeper.

One List to rule them all

Honestly, I was not aware of that list before I started looking at that. What is that list, why is it called DO_NOT_DELETE_SPLIST_TENANTADMIN_ALL_SITES_AGGREGATED_SITECOLLECTIONS.

The name is hillarious. Why name something to “DO_NOT_DELETE…” and all capslockđŸ€Ł. But I suppose, there were support cases.

Beware, that list is not documented, that means you’re on your own when Microsoft changes the name or moves the list to somewhere else. So don’t build business critical solutions with that.

From what I can see, that list keeps information about all sites (site collections) in SharePoint Online, even those that are deleted and permanently deleted (?). This might be a source for deeper troubleshooting in some scenarios. It is like an old card index in a library you might have seen long time ago. It is hidden nowadays, but it is still there.

Image by LisaJasminAdams from Pixabay

First, that list is in the SharePoint Admin Site Collection, you need to be at least a SharePoint Administrator to access it. Okay, I’d like to know what’s more in its Site Contents (_layouts/15/viewlsts.aspx):

Well, the UI of that page has not been focused on, but nevermind, the lists are there. But you cannot navigate to that list in the browser directly:

It doesn’t matter since we can use it as a trigger but also the SharePoint REST API to get the items, e.g.:

https://tenant-admin.sharepoint.com/_api/Web/Lists/GetByTitle('DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS')/Items

You can see more examples of listing the sites in the linked posts. Unfortunately I bumped into an issue when trying to filter the results. If that list contains more than 5000 items (and it will, soon or later), you’ll have to deal with the ListView Threshold.

If you filter on Modified, you won’t able to anything because of the ListView Threshold, but filtering on Created will work.

But this is a side note, this post is automatically detecting new sites, not listing them

Alternative solutions

Using this kind of a hidden list mentioned above is a bit of a hack. I’d say it’s okay as long as it works, and it serves an complementary function, e.g. notifying IT about new sites, and the work is backed up by documented and reliable alternatives:

SharePoint Online Admin

Visiting “Active Sites” in SharePoint Online Admin gives you all the sites, you can sort by Created and see all the new sites. You cannot set up an alert or a flow directly from that, but maybe there will be some built-in functionality for that.

Office 365 Usage Reports

You can get all the sites in an Usage Report, their created, size, last activity etc. It’s not real time, but if you’re fine with 1-2 days delay, you can get this report, extract the new ones and do whatever you wanted to do in your original scenario/need.

SharePoint PowerShell Module

It’s worth mentioning, too, although it’s “heavy”. In a tenant with many sites, the scripts for getting all the sites and connected groups may take hours. I am refering to those scripts that start with Connect-SPOService.

Permissions, Licenses, and Security

The SharePoint connection that listens to the DO_NOT_DELETE_SPLIST_TENANTADMIN_ALL_SITES_AGGREGATED_SITECOLLECTIONS list in the Admin Site Collection needs to be set up with a SharePoint Administrator role account. Beware of who has access to that solution (Power Automate or Logic App), this SPO Admin connection in wrong hands can be disastrous. Especially in Azure, pay attention to who has access to the resource, but also to the resource group and the azure subscription.

The account who sets up a Power Automate needs obviously an appropriate license and also Power Automate activated. In my scenario, I don’t need any premium connectors, but depending on your solution, you might need to license your account appopriately.

Scenarios

In “my” scenario, I want to be notified of all new sites in my business unit within a shared tenant, so that we can contact the site owners, provide guidance and also provision important parts (initial folder structure, some spfx solutions etc).

What is your sceanario?

The code

When I am done developing my proof-of-concept, I’ll try to share more details on the actual implementation. It might be an idea to submit the template to the Microsoft Power Community, but I am not sure it will be accepted, given the fact that it uses undocumented and hidden parts of SharePoint Online that soon or later will be subject to change.

Is an M365 Group a Yammer Community

Nowadays a Yammer Community gets a corresponding Microsoft 365 Group (Office 365 Group, Unified Group). In your work as an SPO Admin, you might need to differentiate “ordinary” Modern Team Sites from those ones that were created for a Yammer Community.

They both have GROUP#0 as Template. On the actual SPO Site object, there is nothing that you can use to differentiate those. Neither you can use the Office 365 Group information. But there is a way: if you connect to Exchange Online and get the group from there, then there is something useful.

I’ll share a piece of code with you, as the rest of the posts and code snippets, it is “evergreen”, it changes all the time, maybe when you read this in future, there is a better way, but today I am using this code:

# Prerequisites
# AllowBasic as Admin, perhaps in a separate window
# Set-ItemProperty -path 'HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WinRM\\Client' -Name AllowBasic -Value 1
# Connect to Exchange Online
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline
# you can get $groupId from the SPO object
$exogroup = Get-UnifiedGroup Identity $groupId
$isYammer = $exogroup.GroupSKU -eq "Yammer"
#Bonus: determine if Team is connected (if $isYammer is $false)
$hasTeam = "Team" -in $exogroup.ResourceProvisioningOptions

Page Diagnostics for SharePoint

While trying to set up a new Home Site, I discovered that there is a tool (browser extension) called Page Diagnostics for SharePoint.

After running this, I tried that command again and it was smart enough to detect the problem the tool discovered.

Also Network Trace is available.

Network trace

Page Diagnostics Tool is defnitely a tool to have in the troubleshooting toolbelt for SharePoint.

Setting up a Home Site

Here is the script:

# Sets up a SharePoint Home Site at Skanska
$tenant = "takana17"
Connect-SPOService https://$tenant-admin.sharepoint.com
$baseUrl = "https://$tenant.sharepoint.com"
# site swap takes 1-2 minutes. be patient
# https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/invoke-spositeswap?view=sharepoint-ps
Invoke-SPOSiteSwap SourceUrl "$baseUrl/sites/futurehomesite" TargetUrl "$baseUrl" ArchiveUrl "$baseUrl/sites/oldroot-deleteit"
# Home Site. Docs: https://aka.ms/homesites, it make take some time
Set-SPOHomeSite HomeSiteUrl $baseUrl
view raw spo-home-site.ps1 hosted with ❤ by GitHub

Deploying SPFx using Office 365 cli, custom AAD App and Azure Pipelines

In this post I would like to share some findings from setting a deployment of SPFx. In my work:

  • I need to deploy SPFx solutions using Azure Pipelines
  • I need to use the least privileges/permissions
  • I cannot use Legacy Authentication

First of all, big thanks to @waldekm and the whole community of @office365cli and @m365pnp for the quick help, and that outside working hours.

Let’s take a look at the setup piece by piece

Least Privileges

I followed this guide to set up a custom App Registration for Office 365 CLI in order to use the least privileges:

Custom Azure AD App

For uploading and deploying SPFx packages I found these permissions to be the bare minimum:

  • Delegated Microsoft Graph User.Read
  • Delegated SharePoint AllSites.FullControl

Service Account

The second part is the service account that just has access to one site collection – Tenant App Catalog. That plus Delegated AllSites.FullControl of the app registration narrows the access to just that site. To install apps the Uploader Account needs to be Site Collection Administrator.

Least privileges for SPFx Upload & Deploy

Azure Pipelines

In our project we use Azure Pipelines where we also define the release using .yml. The deployment consists of series of bash inline scripts.

I am not going to describe all the steps for setting up node, npm and installing the office 365 cli. If you already have used Office 365 CLI with the default AAD APP it might look like this:

task: Bash@3 # login
displayName: "Login to O365 spAppCatalogSiteUrl with user $(username)"
inputs:
targetType: "inline"
script: 'o365 login "${{ parameters.spAppCatalogSiteUrl }}" -t password -u $(username) -p $(password)'
task: Bash@3 #upload
displayName: "Upload web part ${{ parameters.spfxPackageName }} to catalog"
inputs:
targetType: "inline"
script: 'o365 spo app add -p "$(Pipeline.Workspace)/${{ parameters.environment }}/${{ parameters.spfxPackageName }}" –overwrite'
task: Bash@3 #deploy
displayName: "Deploy ${{ parameters.spfxPackageName }} web part"
inputs:
targetType: "inline"
script: 'o365 spo app deploy –name "${{ parameters.spfxPackageName }}" –appCatalogUrl "${{ parameters.spAppCatalogSiteUrl }}"'
view raw deploy-spfx.yml hosted with ❤ by GitHub

Now comes the tricky part! If you followed the guide mentioned above, you must have noticed the two environment variables that you need to have:

export OFFICE365CLI_AADAPPID=506af689-32aa-46c8-afb5-972ebf9d218a
export OFFICE365CLI_TENANT=e8954f17-a373-4b61-b54d-45c038fe3188
view raw deploy-spfx-env.sh hosted with ❤ by GitHub

That’s straight forward when you run the cli in your own console. But the fact is (or at least from what I can see), you cannot “export” variables to other pipeline tasks.

Instead of setting the variables in the inline script, we can take advantage of the Bash task parameter called env:.

Some other findings:

  • Office 365 CLI needs them in all three commands: login, spo app add, and spo app deploy
  • If you create and export a variable in a pipeline task, it won’t persist, because every task starts a new shell session.

That means that we need to provide environment variables in every task in the pipeline, that uses Office 365 CLI with a custom Azure AD App. Or is there a better way? Anyway, the version below (the same tasks plus `env`) will work:

task: Bash@3 # login
displayName: "Login to O365 spAppCatalogSiteUrl with user $(username)"
inputs:
targetType: "inline"
script: 'o365 login "${{ parameters.spAppCatalogSiteUrl }}" -t password -u $(username) -p $(password)'
env:
OFFICE365CLI_AADAPPID: "${{ parameters.o365cliAppId }}"
OFFICE365CLI_TENANT: "${{ parameters.tenantId }}"
task: Bash@3 #upload
displayName: "Upload web part ${{ parameters.spfxPackageName }} to catalog"
inputs:
targetType: "inline"
script: 'o365 spo app add -p "$(Pipeline.Workspace)/${{ parameters.environment }}/${{ parameters.spfxPackageName }}" –overwrite'
env:
OFFICE365CLI_AADAPPID: "${{ parameters.o365cliAppId }}"
OFFICE365CLI_TENANT: "${{ parameters.tenantId }}"
task: Bash@3 #deploy
displayName: "Deploy ${{ parameters.spfxPackageName }} web part"
inputs:
targetType: "inline"
script: 'o365 spo app deploy –name "${{ parameters.spfxPackageName }}" –appCatalogUrl "${{ parameters.spAppCatalogSiteUrl }}"'
env:
OFFICE365CLI_AADAPPID: "${{ parameters.o365cliAppId }}"
OFFICE365CLI_TENANT: "${{ parameters.tenantId }}"
view raw deploy-spfx-env.yml hosted with ❤ by GitHub

Eliminating Legacy Authentication

My goal is to remove the need of legacy authentication. Previously we installed spfx packages using PnP PowerShell. PnP PowerShell in Pipelines causes Legacy Authentication, it can be solved, though:

Using Office 365 CLI rather than PnP PowerShell with a certificate has some significant benefits:

  • Office 365 CLI is multi-platform, you can reuse the scripts. PnP PowerShell requires Windows (yet, but still).
  • Setting up certificates and using it in the deployment process is a bigger initial task.

Release Pipelines

Just for completeness, in a classic release pipeline, you can use a bash script to upload and deploy an app:

#runs in Ubuntu 20.04 Bash Task
sudo npm install -g @pnp/office365-cli
export OFFICE365CLI_AADAPPID="$(OFFICE365CLI_AADAPPID)"
export OFFICE365CLI_TENANT="$(OFFICE365CLI_TENANT)"
o365 login –authType password –userName $(AppCatalogUsername) –password "$(AppCatalogPassword)"
export filePath="$(System.DefaultWorkingDirectory)/dist/$(env)/$(fileName)"
o365 spo app add -p "$filePath" –overwrite
o365 spo app deploy –name "$(fileName)" –appCatalogUrl "$(AppCatalogSiteUrl)"
view raw release-bash.sh hosted with ❤ by GitHub

In our example we also send data to Azure CDN using Azure CLI:

az storage blob upload-batch \
–source $(sourceFolder)/bundledFiles \
–destination $(storageContainer)/$(toolPath) \
–account-name $(storageAccount)
view raw azure-cli.sh hosted with ❤ by GitHub

Kalendern i SharePoint

Dags för ett svenskt inlÀgg igen. Idag vill jag titta pÄ kalenderfunktionaliteten i SharePoint Online.

Fortfarande gammalt (classic) utseende

TyvÀrr Àr det gammalt utseende som gÀller och det finns inga planer frÄn Microsoft att modernisera kalendern:

Jag förstÄr att det Àr vÀldigt mycket kod för att fÄ till kalendervyn och att det inte Àr sÄ lÀtt omvandla till ett modernt utseende, men det stÀller till eftersom det upplevs som gammalt och inte anvÀndarvÀnligt ute i verksamheten.

Varför behövs en SharePoint-kalender

Jag ska lista nĂ„gra alternativ och förklara varför en gammal dinosaurie Ă€r fortfarande det enda vettiga alternativet (i vĂ€ntan pĂ„ en “modernisering” av lsitan)

En Office-365-gruppkalender

Det Àr en bra funktionalitet för en enkel kalender. Den saknar:

  • Stöd för extra kolumner och innehĂ„llstyper
  • Den Ă€r svĂ„r att dela med externa anvĂ€ndare

HĂ€ndelser (Events)

Om du inte hittar lÀnken till den hÀr sidan, finns den under <site>/_layouts/15/Events.aspx. En snygg modern sida som kan visa kalenderhÀndelser frÄn flera kalendrar pÄ SharePoint-siten. Dess begrÀnsningar Àr:

  • GĂ„r inte att anpassa, eftersom det Ă€r en systemsida (layous-sida)
  • Den visar bara det minimala om hĂ€ndelser

En kalender utanför Office 365

Har man egen kalenderdata, Àr man friare, men man förlorar fördelarna med att ha/betala för en dyr platform. Om man ocksÄ har ett eget grÀnssnitt för det kostar det att i lÀngden med alla anpassningar och buggrÀttningar.

SPFx-lösning

I SharePoint skulle man kunna ha en SPFx-lösning för att presentera kalenderdata pÄ ett snyggt sÀtt. Men det fÄr avvÀgas mot kostnader. Det fina med inbyggda kalendern var att den bara fanns dÀr, den ingick i plattformen.

Kalendern i SharePoint

Till fördelarna av kalendern i SharePoint hör:

  • Det Ă€r en del av ett större ekosystem. Power Automate eller PowerApps kan kopplas pĂ„, som ett exempel. Det visas ocksĂ„ i moderna Events.aspx
  • Det Ă€r anpassningsbart pĂ„ ett enhetligt sĂ€tt, som alla andra listor. AnvĂ€ndare med rĂ€tt behörighet kan skapa nya kolumner, definiera innehĂ„llstyper med mera.
  • PnP-mallramverket kan bĂ„de exportera och importera en kalender.
  • Listvyer, behörigheter, mappar, allt det ingĂ„r om man behöver det, pĂ„ samma sĂ€tt som det gör för alla andra listor i SharePoint.
  • Möjlighet till sök och aggregering ifrĂ„n flera siter.
  • En chans att det moderniseras utan att man behöver investera nĂ„got i det extra.
En förenklad vy genom “HĂ€ndelser” av samma kalenderlista.

Lite tips och tricks för gamla kalendern

HÀr kommer en liten samling av enkla men intressanta tips för gamla kalendern.

#1 VÀlj tid för en ny hÀndelse med en annan innehÄllstyp pÄ ett smidigt sÀtt

Det hÀr har varit en av de sakerna som man varit mest frustrerad över. NÀr en kalender har flera innehÄllstyper, gÄr det inte att byta innehÄllstyp i NewForm nÀr du klickar i kalendervyn.

Om du vÀljer en annan innehÄllstyp, mÄste du manuellt ange tiden. Det tar tid. Föreslagna tiden Àr bara aktuella timmen hÀr och nu.

Tipset Àr att:

  1. Hitta rÀtt dag och markera rÀtt tid i kalendervyn. Rutan fÄr en blÄaktig fÀrg.
  2. Klicka pĂ„ “Ny hĂ€ndelse” i Ribbon (vad var svenska namnet för det?).
  3. Vips sÄ har du tid och datum rÀtt ifrÄn början

#2 Kalenderöverlag

En klassiker, en av mina favoriter Ă€r möjligheten att visa kalenderhĂ€ndelser med olika fĂ€rger – kalenderöverlag. TyvĂ€rr Ă€r det begrĂ€nsat med fĂ€rger.

#3 Visa veckovyn utan att Àndra instÀllningar

I lĂ€nken till din kalender (t.ex. i vĂ€nstermenyn), lĂ€gg till “?calendarperiod=week” i URL:en, sĂ„ visas veckovyn automatiskt.

Snabba diagram i SharePoint Online

Ett nytt tips pÄ svenska: det finns en webpart i SharePoint Online: snabbdiagram.

NÀr du har lagt till ett snabbdiagram, kan du skriva vÀlja mellan stapel och cirkeldiagram

Du kan bara vÀlja mellan stapel- och cirkeldiagram.
Data gÄr att mata in direkt.

Resultatet fÄr du direkt:

AnvÀnd data frÄn en lista

Det gÄr att visualisera data frÄn en SharePoint-lista. Det Àr inte sÄ mycket mer komplicerat, men det öppnar nya möjligheter. Du behöver bara hÄlla listan uppdaterad.

Nyttan med snabbdiagram

Det finns mÄnga olika sÀtt att visualisera data: PowerBI, Excel diagram, man skapa egna webparts. Men det Àr inte sÄ sÀllan nÀr man vill bara en liten visuell hjÀlp för att kommunicera ett budskap. IstÀllet för att fastna pÄ teknikaliteterna, kan man snabbt smÀlla upp ett diagram. Det gör inte heller att man behöver manuellt uppdatera sidan/listan.

Bra jobbat, Microsoft!

Bara moderna sidor

Snabbdiagram finns bara i “moderna” sidor, inte i klassiska sĂ„dana (wikisidor, webbdelssidor).

Mer SharePoint pÄ svenska

Jag tĂ€nker anvĂ€nda taggen “svenska” för alla mina poster skrivna pĂ„ svenska.

Troubleshooting Performance in SharePoint Online

This is my personal list of links and thoughts on troubleshooting performance in SharePoint Online.

Resources

Health info in Response Headers

Every response from SharePoint Online contains some health information:

Following Response Headers could reveal the health:

  • x-sharepointhealthscore, 0-10 score, the higher score the more loaded is the SharePoint Server.
  • spiislatency, time in ms that the request waited to be processed by IIS. Unfortunately, I cannot see this value as of writing (2019-10-14)
  • sprequestduration, time in ms IIS took to process the request. Unfortunately, I cannot see this value as of writing (2019-10-14)

Switch back to Modern UI

Just a little tip. When you switched to a Classic View of Site Contents, you can switch back by removing a cookie called “splnu”.

Daniel Chronlund Cloud Tech Blog

News, tips and thoughts for Microsoft cloud fans

Đ’ŃƒĐ»Đ° ЧăĐČашла

VulaCV - ЧăĐČашла ĐČŃƒĐ»Đ°Ń‚Ń‚Đ°Ń€Đ°ĐșĐ°Đœ саĐčт

Discovering SharePoint

And going crazy doing it

Bram de Jager - Architect, Speaker, Author

Microsoft 365, SharePoint and Azure

SharePoint Dragons

Nikander & Margriet on SharePoint

Mai Omar Desouki

PFE @ Microsoft

Cameron Dwyer

Office 365, SharePoint, Azure, OnePlace Solutions & Life's Other Little Wonders

paul.tavares

Me and My doings!

Share SharePoint Points !

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum frÄn Jimmy Janlén

Aryan Nava

DevOps, Cloud and Blockchain Consultant

SPJoel

SharePoint for everyone

SharePointRyan

Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint

blksthl

Mostly what I know and share about...