CHUVASH.eu

CHunky Universe of Vigourous Astonishing SHarepoint :)

Tag Archives: sharepoint online

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

Estimated Completion in Write-Progress in PowerShell

Have you also got many sites in your tenant? Write-Progress is the bare minimum in a script that goes through all sites. But there is also another nice way to make easier to see the progress – estimated completion time.

Although the idea comes from another blog post (My life is a message), I thought it could be worth sharing it again, especially in the cloud context.

Here is a bit simplified scenario: Getting information for every site. The status message in Write-Progress contains also the estimated completion time.

# This is just an example for time estimations in write-progress,
# though a simplified scenario
$sitesBareMinimum = Get-SPOSite Limit All
$starttime = Get-Date
$count = 0 # kind of an index, counter
$total = $sitesBareMinimum.Count
$sites = $sitesBareMinimum | ForEach-Object {
$site = $_
$estimation = ""
$now = Get-Date
if ($count -gt 0) { # noone wants a DividedByZeroException 🙂
$elapsed = $now $starttime # how much time has been spent
$average = $elapsed.TotalSeconds / $count # how many seconds per site
$totalSecondsToGo = ($total $count) * $average # seconds left
$span = New-TimeSpan Seconds $totalSecondsToGo # time left
$estimatedCompletion = $now + $span # when it will be complete
$estimation = $estimatedCompletion.ToString() # readable estimation
}
$count++
$percent = 100 * $count / $total # percentage complete
$status = "#{0:d5} of $total. Est:d $estimation. $($site.URL)" -f $count # aggregated status message
Write-Progress Activity "Getting information for " Status $status PercentComplete $percent
$siteWithMoreInfo = Get-SPOSite Identity $site.URL # the actual time consuming operation
$siteWithMoreInfo # return the site with more information
}

I included the comments, and it should be straight forward to follow the logic in the script. Every iteration tries to estimate time, by calculating the average time of time per site, mulplying it by the remainder of the sites and adding it to the current time. The more sites are processed, the more accurate is the estimation.

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.

Renaming site urls

I saw a demo of it on the European SharePoint Conference in Copenhagen in 2018. Sebastian Fouillade, who showed this, compared this big change with brain surgery. All the urls, all the connections. But now it is possible. Today I have seen it even in my standard release tenant.

It is really appreciated. Soon it will be possible to rename misspelled sites, like “devlepment” to “development” etc.

To rename you need to go the SharePoint Admin, find your site among Active sites and click on “Edit” in the site url area.

I also can image, it will be very handy to change the url of a SharePoint site that was automatically created for a Team (through the Office 365 Group). The team might have some longer name, but a simpler url is often appreciated.

I have tried and seen that also the automatic redirects from an old site url to a new site url works.

Caveats and Limitations

mailNickname ≠ site url

Now it is even more important to not to rely on the fact that mailNickname of an Office 365 Group and Site url are the same. As Elio Struyf describes, it is not a good idea to compose a URL from the group name. I have used in PoCs the site url to get the group id:

GET https://graph.microsoft.com/v1.0/groups?$filter=mailNickname eq 'my-group' 

Now it the amount of cases where it will work, will be less.

Not all site types can change url

I have found that the App Catalog site cannot get a new url, neither sites with Publishing Features.

The official message from Microsoft

We’re making it possible for SharePoint administrators to change site URLs.

  • We’ll be gradually rolling this out to customers in mid-October.
  • The roll out will be completed worldwide by the end of October.

This roll out does not apply to Office 365 subscriptions for EDU tenants.

This message is associated with Microsoft 365 Roadmap ID 56205.How does this affect me?

As a global or SharePoint admin in your organization, you will be able to change the URL for the following types of sites (previously called “site collections”):

  • Classic team sites
  • Communication sites
  • Modern team sites that don’t belong to an Office 365 group
  • Office 365 group-connected team sites

For example, if you have a site named https://contoso.sharepoint.com/sites/Develpment, you can rename the site to correct the incorrect spelling of “development” via the SharePoint admin center.

Automatically-generated redirects will ensure that old links do not break.What do I need to do to prepare for this change?

There is nothing you need to do to prepare for this change, but you may consider updating your user training and notifying your help desk.

Learn more about changing a site address.

The CDN concept in SharePoint

How many instances of jquery are there in your SharePoint farm?

 Get-SPWebApplication http://dev `
  | Select -Expand Sites `
  | Select -Expand AllWebs `
  | Select -Expand Lists `
  | Select -Expand Items `
  | ? { $_.Url -match "jquery.*.js" } `
  | select Name, Url

Have you more than two (jquery and jquery-ui), then you have too much. You can save much place and performance by using Content Delivery Network (CDN) links for the resources like javascript, css, fonts and icons. Consider those Content Delivery Networks:

CDN for custom resources

But can we benefit from this CDN concept for our custom resources? I think so, if your farm has ten thousands of site collections, and you deploy javascript files, css files in the Style Library, it would be great to eliminate resource duplicates. So my thougt is to deploy resources to one place. It could be:

  • An external web application static.contoso.com like many web applications do
  • A dedicated site collection for resources cdn.contoso.com with Anonymous access
The CDN concept in Office 365

Have you noticed that Office 365 uses cdn links for almost all SharePoint javascript files that traditionaly were referenced from the _layouts folder

cdn-001

With this I want to raise a question. What do you think about the CDN concept within SharePoint? Have you used it? Have you plans to have it?

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...