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.