Tuesday, September 20, 2016

PowerShell script to upload user profile images to Office 365

There are numerous posts out there about how to do this, but thought I’d share my small script which includes the option to have images > 10kb. The script assumes you have a folder with with images on the notation <username>.jpg. It will loop over all images and use the Set-UserPhoto commandlet to upload the image.

The first time you run the script it prompts you for the password for the account you are using and stores it as a secure string in a file to be used on sub-sequent runs or on a schedule. The script will also move images one folder up after processing.

$adminUser = "foo@contoso.onmicrosoft.com"
$localFolderPath = "d:\images\upload" 
$passwordFile = "$PSScriptRoot\userphoto-password.txt"

    read-host -prompt "Type the password for $adminUser to be used (will be saved encrypted)" -assecurestring | convertfrom-securestring | out-file $passwordFile

$password = cat $passwordFile | convertto-securestring
$MSOLCred = new-object -typename System.Management.Automation.PSCredential `
         -argumentlist $adminUser, $password

$ExOLSession = New-PSSession -Credential $MSOLCred -authentication Basic -Configurationname Microsoft.Exchange -ConnectionURI https://outlook.office365.com/powershell-liveid/?proxyMethod=RPS -allowredirection

#load Exchange Online Management cmdlets
Import-PSSession $ExOLSession -AllowClobber

$files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles() |  ForEach-Object {
    if(([IO.Path]::GetExtension($_.FullName)) -eq ".jpg") {    
        $username = [IO.Path]::GetFileNameWithoutExtension($_.FullName);    
        $userPhoto = ([Byte[]] $(Get-Content -Path $_.FullName -Encoding Byte -ReadCount 0))
        Set-UserPhoto -Identity $username -PictureData $userPhoto -Confirm:$False
        #move files one folder up after processing
        $destinationFolder = Split-Path -Parent $_.Directory.FullName
        move-item $_.FullName $destinationFolder
#unload session
Remove-PSSession $ExOLSession

Thursday, September 15, 2016

SharePoint Online Search Toolbox

Bilde av app
Finally! It’s taken me a while to get this app ready as I’ve developed it in spare evening hours here and there. But it’s out, and I hope it fills a need.

SharePoint Online Search Toolbox by Puzzlepart
Get the app!

Creating search based solutions and troubleshooting search in SharePoint Online takes time. Time and money more wisely spent on the actual solutions themselves. Over time I’ve discovered two major gaps when we moved from on-premises to online: Being able to run full crawl when we change the search schema and being able to investigate and look at the crawl log.

'SharePoint Online does not allow the same control as SharePoint 2013/2016, but there are ways. Previously I’ve created PowerShell scripts to trigger re-indexing of content and user profiles, and you can actually via e-Discovery get access to the SharePoint Online crawl log, but this also expose all your content – something you might not want to give out to anyone.

Hence, I started developing SharePoint Online Search Toolbox. The application gives you a UI to view the crawl log, much like you can on-premises, and it also allows you to trigger re-indexing of user profiles or content tenant wide. The app is distributed on subscription, per tenant but if you’re like me and my colleagues at Puzzlepart, you should quickly save this when a search issue arise.

If people value the application, and have suggestions for features, they might just be added :)

And.. if you’re a Puzzlepart Assist 365 customer, we’ll throw the app in for free!

App image

Friday, September 9, 2016

Why you should use tools like SPCAF when developing for the SharePoint framework

Just want to say that I’m not affiliated with Rencore in any way, and I write this review on my own merit – not being asked or forced to do so :-)

Being an Office Server and Services MVP I know most of the guys at Rencore, and have for a long time. As I’ve been part of the SharePoint Framework preview program at Microsoft, the guys at Rencore asked me if I wanted to test out a beta version of SPCAF for the SharePoint Framework. As I’ve just completed a SPFx web part for an Ignite showcase I figured I’d give it a shot.

I first had some issues with the SPCAF license they gave me, but that got fixed fairly quick. These guys know how to provide stellar support for sure.

So what happened when I ran gulp spcaf in my project?


4 critical errors, 6 errors and 1 warning

The critical ones were related to custom web part properties which I had forgotten to add to the web part manifest, and one which was in the manifest, but I wasn’t using. The warning was due to I had specified both to use a font based icon and an image based icon for the web part – left overs from testing (and a bug filed). All easily fixed as it pointed me to the file needed fixing.

The 6 errors were related to dependencies for Office UI Fabric components I had forgot to list in the external list. I did have the main component listed which was done automatically when I added the package, but the specific components I had not thought about (Button, List, Spinner etc). I knew the file for this was config.json in the config folder, but would be nice if the report stated so as well. Rencore, you fix? :-)

So, all in all.. config errors, none real critical, but nice to have fixed for sure. And I’ll definitely continue to use SPCAF for future SPFx projects. It takes over where the linting of TypeScript ends. I give it two thumbs up!

Thursday, September 8, 2016

Office 365 Groups , Delve Analytics and Search–I’ll be speaking at Microsoft Ignite 2016


A couple of more weeks now and Ignite kicks off! I had a blast last year and I’m looking forward to see how this years event turns out as well as looking forward to hang out with new and old friends in the SharePoint community.

Here’s the breakdown of the three sessions I will be delivering – and if you’re going maybe I’m covering a topic you’re interested in.

Be more effective with Delve and Office Graph Analytics

THR2191 – 20 minutes - Wednesday, September 28, 2016 5:05 PM - 5:25 PM – Expo Theatre 3

Are you curious about how Delve Analytics and the information in the Microsoft Office Graph can make you more effective? Get a quick demo of the insights available out of the box in the different Office 365 plans and you might just end up more self conscious about how and who you work with.

Move search from on-premises SharePoint to the cloud: tips and tricks

THR3055 – 20 minutes - Thursday, September 29, 2016 1:35 PM - 1:55 PM – Expo Theatre 4

Going cloud means you have to analyze your on-premises setup and see what works in the cloud. This session covers some of the bumps you might encounter and show possible alternative roads to make sure the journey is successful. We touch on both moving content and search to the cloud, and the new Cloud Search Service Application for hybrid scenarios.

Learn about Office 365 Groups and how to use them

BRK2277 – 45 minutes - Friday, September 30, 2016 9:15 AM - 10:00 AM – C114
(Originally labeled as a panel discussion – but it will be a demo session)

Microsoft Office 365 Groups uses the best of breed functionality of many Office 365 services like e-mail and calendars from Outlook, files and OneNote from SharePoint and tasks from Planner. You can also create pages and lists with the recently announced team site attached to the group.

With all this functionality, where should you start and how can Office 365 Groups help your business?

The session gives an overview of what Office 365 Groups are, and will cover use cases like event handling, marketing planning, educational use as well as social media handling, where Office 365 Groups can be a good fit for your organization.

Tuesday, August 30, 2016

Why you should use Azure AD id’s and not e-mail addresses or UPN when bulk importing user profile properties to SharePoint Online


Back in April Microsoft released details of a new API do do bulk import of user profile properties in SharePoint Online. Say you have a field with an employee id, and you want to set this for all users in your organization. As Azure AD does not allow you to map custom fields into the user profiles automatically you have to set the data your self. Previously you could use the user profile API as an admin to do this, but it was not possible if you were for example using an automated app with app tokens, and you also had to loop over all profiles, updating one at a time.

You can read more about the API and see a full code sample at https://dev.office.com/blogs/introducing-bulk-upa-custom-profile-properties-update-api.

Tuesday, August 23, 2016

Custom hyperlink icon column using Flow

Laura Rogers (@wonderlaura) writes awesome end-user SharePoint posts, and recently wrote one which caught my eye – “Custom hyperlink icon column”. The write-up explains how you can add a custom column to a SharePoint list which shows an icon with the use of SharePoint workflows. This got me thinking if this is doable using Flow instead…. and it is :)

I suggest you read Laura’s post first, then go ahead with this one.


Note: This only works for SharePoint lists at the moment using Flow, not document libraries

For my scenario I will cover how to add a custom edit icon to a list – which in a modern list view takes you to edit mode in one click instead of two. Wooo!

Friday, August 19, 2016

Overriding default styles in a SharePoint Framework project


I’m building something using the pre-release of SPFx and by default when you start a project you have a SASS scss file for styles named something like MyPart.module.scss. This is all fine. Say you create a class:.myClass {}

This will be bundled and prefixed for you to be unique when you run the web part, like this: .myClass_e90cb14c

But what if you don’t want class names to be prefixed? In my case I needed to overload some styles coming from a component I’m not controlling. It’s actually very very very easy. I added a normal .css file to my project and at the top of the .cscc file I added the good ‘ol import statement like this:

@import url('MyPart.override.css');

The imported file will be included just fine, just not prefixed like the ones in the scss file.

(Thanks to the Kimzter for hinting I should try this)

Thursday, June 23, 2016

Introducing Microsoft Forms*

June 20th, 2016 Microsoft announced the preview of Microsoft Forms, a new formative assessment and survey tool in Office 365. The caveat is that it’s targeted to Educational licenses only. This means Enterprise customers can not use this at the moment, but as the announcement says, Microsoft is exploring the possibilities for it but with no time line.

You can find it at https://forms.office.com if you have an EDU license.

Let’s not dwell on license issue and see what Microsoft forms all about? The product today is an answer to educators to have a quizzing function inside of Office 365 – not a replacement for InfoPath if that is what you are looking for.

Wednesday, June 15, 2016

How to favorite a Groups calendar for easier access in the Outlook Windows client

Office 365 Groups comes with a real Exchange calendar, but accessing a Group calendar is a bit cumbersome via the Outlook 2016 client. You first have to expand the Groups listings in e-mail view, select your group, and then click the calendar button in the ribbon. A different experience than clicking the calendar view and then the calendar.


When clicking the Calendar button, a new window opens. In the new window locate your group in the folder navigation pane, right click the group and pick Add to Favorites…

imageIf you go back to the original Outlook window, click to view calendars in the folder view, you should now see your Group calendar in the My Calendars list, much more accessible.


I hope the Groups navigation experience towards the different services proliferate into all contexts and apps over time, but for now this is as good a workaround as any to have Group calendars appear side by side with your other calendars.

Want to remove the calendar? Use the same approach, but Add to Favorites has turned into Remove from Favorites.

Friday, June 3, 2016

Bringing out the client side hammer - The one thing you should learn about SharePoint search in 2016


SharePoint 2013 has been out for a good while now with SharePoint 2016 well on it’s way, and over the years there are some major flaws which has crystalized itself to me in SharePoint search - especially if you are working in SharePoint Online. So if you plan on learning just one thing about how SharePoint search work this year, this post is for you!

The top four flaws in my opinion are:

  • Best bets / promoted results via query rules
  • Synonym handling / Thesaurus
  • How query rules trigger
  • Remove custom noise words from the query

This post covers a client side solution to solve the last three points above, and I started this back in January based on a conversation with Thomas Mølbach at Microsoft about solving synonyms in SharePoint Online. I’ve had it linger for a while and finally Elio Struyf finished the code and pushed me to get it out there. The solution can be found at the the Github SPSCR project.