How to interpret SharePoint’s view count managed properties (like “ViewsLast1Days”)?

Let's fix SharePoint Search together!

Have you ever wondered, how SharePoint’s Managed Properties for Usage & Analytics info actually work? There are all these nice properties available for getting view counts for different items in SharePoint’s search index, but they all seem to act like crazy. And they are pretty nonsensical… And not very well documented!

In this post I’ll try to make some sense on how you can use them in programmatic scenarios. Read on…

Continue reading

Properly checking if an item in a folder is a Directory or not in PowerShell

PowerShell header

Got a great tip from a colleague, on how to properly check if an item is a file or a directory. In one case, we weren’t really ever sure, if another script had finished its running and unzipped a certain zip package into a folder – and we had to verify it had, before continuing the execution. Our initial implementation worked most of the time… But not quite always. The purpose of this blog post is to explain how we found a pretty well working and elegant solution!

Problem

In this particular case, we were testing items for being directories with the following script:

$item = Get-ChildItem -Path [path_to_item]
if ($item -eq $null -or $item.Attributes -ne "Directory") {

However, that doesn’t work that well, as it breaks with whatever additional attributes being applied to the file or folder. And there’s a lot of situations, where new attributes get added to items in a folder. One good example is “NotContentIndexed”, which gets added if you (or whatever piece of automation) sets the file to be excluded from Windows Search index. See the references for more details about the attributes!

After some back and forth, we ended up improving the script in a few ways.  Continue reading

Disabling requests to WsaUpload.ashx (Customer Experience Improvement Program)

Requests to WsaUpload.ashx showing up on the Network -tab of your browser

So, I’ve gotten this question from a lot of customers and partners, and I thought it’s worth clarifying the case a bit. “I’m seeing a lot of requests these requests to WsaUpload.ashx. What do they matter? They seem to degrade the performance – so what can I do about them?”

That’s a great question! Let’s see what it is, why it exists, and what we can do about it!

Continue reading

Create a new Alert to a SharePoint list

Brace yourselves! Notification emails from SharePoint are coming.

Alerts. That magnificent functionality in SharePoint, that let’s you get a heads-up anytime someone touches your precious documents (so you can go and revert the changes), or changes files in Style Library (so you can go and remove that pink custom CSS they tried to add). They are ancient, quite cumbersome and CERTAINLY not pretty, but quite reliable (and despite my expectations – they were included in Modern SharePoint, too!), so there’s really no reason to still keep using them.

However, every now and then, they’re quite hidden from the GUI. This post describes how to access them on pretty much any site!

Continue reading

Fastest way to verify your Client Id and Client Secret are valid with PowerShell

Get-MsolServicePrincipalCredential - how to get the expiration date for a clientId

So, you have a Client Id and a Client Secret, but don’t know if they work anymore? Maybe they are expired? Maybe someone removed them? No worries! We can use PowerShell to validate them easily!

Solution

By using PowerShell, it’s fairly straightforward to verify, that your Client Id and Client Secret work. See the snippets below for 2 different steps:

  1. First we validate, that the values work.
  2. If they don’t, let’s run another script to see if the Client Id exists but has expired.

Validate your Client Id by trying to connect with it

We can validate the Client Id and Secret, by using Connect-PnPOnline to connect to SharePoint Online. 

Continue reading