Wednesday, February 12, 2020

Set a document to open in view-only mode by default

Document productions and lifecycles come in many shapes and fashion. One scenario is sharing a document without the intent for the reader to necessarily make any edits or comments. To reduce the footprint of auto versioning and accidental edits of a document you have the ability to explicitly make the document open in view-only instead of in edit mode.

Other people may still edit and comment the document, but they must first make an explicit choice to do so.

If you didn’t know about this easy tip, here’s a video showing how you enable it using Word Online. The same setting is also available via desktop clients. If you already knew how, then you’re all set :)

Wednesday, January 22, 2020

Retrieving thumbnails/previews for SharePoint files and pages via Microsoft Graph API’s

Back in 2011 I wrote a post about thumbnail previews in search via the Fast Search for SharePoint which relied on Office Web Apps to provide the actual thumbnails. Fast forward to 2020, visualizing a page or document in a roll-up scenario is still valid, and fortunately todays service allows much better resolution on the thumbnails.

The API itself is coming via the Microsoft Graph and works on driveItems and is well documented at https://docs.microsoft.com/en-us/graph/api/driveitem-list-thumbnails.

If you want to test this out yourself, download the SPFx sample from https://github.com/SharePoint/sp-dev-fx-webparts/blob/dev/samples/js-msgraph-thumbnail/README.md to get started.

preview

Digging into the API’s, the approach I have chosen to go from a SharePoint item to a Graph item is to use the site id, list id and item id – all id’s easily available per SharePoint item, either via REST API’s or the search API, using the calling signature below:

<endpoint>/sites/<site id>/lists/<list id>/items/<item id>/driveItem/thumbnails/0/<custom size>/content

The above URL can be used directly in an <img> tag, removing the need for multiple calls in order to get the actual image.

Token Description
endpoint graph.microsoft.com/v1.0 (https://docs.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0)

tenant.sharepoint.com/_api/v2.0 (https://docs.microsoft.com/en-us/sharepoint/dev/apis/sharepoint-rest-graph)
site id Site object id – GUID.
list id List object id – GUID.
item id ListItem object id or unique id – Integer/GUID.
custom size See Requesting custom thumbnail sizes in the official Microsoft Graph documentation.

If you choose to get the drive item in a different way, that’s all good, as the thumbnail API itself would be the same. In addition to using custom sizes for the preview, there are also some default sizes you can use, all documented.

The above approach have been verified for most common file types (except Excel) as well as for modern pages.

Monday, December 9, 2019

Troubleshooting Search in SharePoint Online

coverOver the past years I’ve aggregated patterns and ways I use when troubleshooting why search results does not appear in the way you would expect. Some of it has appeared as blog posts, but for a while I’ve been thinking of putting it into a structured format.

Hence the book “Troubleshooting Search in SharePoint Online” was born. The book is a brain dump of my experience combined with help from others, and is means as a self-help book on investigating search issues before you go to the step of filing a support ticket. If you end up filing a support ticket, the process should be smoother as well as you should have aggregated good information on what you have tried so far :)

The focus is on why items appear or don’t appear, or are missing values etc., not why your KQL queries are not working as intended. Combined with my previous book on search queries, you should be armed with good tools to build and investigate search.

If you’re still using SharePoint on-premises, many of the concepts still apply, so it’s still a good read.

Where can you get the book? Head over to Amazon!

Wednesday, October 16, 2019

Breaking SharePoint search since 2013 – a lesson into unintentional consequences of messing with out of the box managed properties

image

I’ll start this post with a revised version of “Mikael’s managed property rule of three”, now called “Mikael’s managed property rule of four”:

  1. Never ever mess with the out of the box managed properties.
  2. Use automatic/implicit managed properties if possible.
  3. Map crawled properties (the plain ows_columnname ones) to the RefinableXXYY re-usable properties if possible. And do give them a unique alias for easier management and use.
  4. Create a custom managed property as last resort – which is only possible for Text and Yes/No columns.

Following these four rules will make your life easier, and help out troubleshooting search issues you might encounter.

Sometimes you think you know it all and then SharePoint search throws you a curveball. It’s been dormant all these years as it’s pretty much an edge case, but knowing this trick you can effectively break SharePoint search experiences quite magnificently :) Sounds fun right?

Note: You need access to the tenant search schema to break search experience globally, or employ this on your own site collections for mayhem and otherwise rendering yourself unpopular.

Monday, August 26, 2019

Classic vs Modern and More Microsoft Search Questions Answered


imageOver the past several weeks there has been a number of community questions on classic vs. modern search in relationship to SharePoint and Microsoft Search across social channels. We selected the most common questions and created a Q&A article over at the Microsoft Tech Community to help answer those.

If you have comments or questions, scoot over to Tech Community and let us know.

https://techcommunity.microsoft.com/t5/Microsoft-Search/Classic-vs-Modern-and-More-Microsoft-Search-Questions-Answered/m-p/797933


Friday, August 23, 2019

I can see it! KQL in the house! HCWP love!

I’ve known this was coming for a while and I can finally see it in my tenant! KQL support for the highlighted content web part has finally arrived. Knock yourself out and surface content any way you want via search, (as long as the visuals cover your needs).

image
If you’re really crazy and bold, target the web part to a list/library and crank out your favorite CAML queries as well – not sure why you would ever go there though :D

image

Thursday, August 8, 2019

Update to using Microsoft Flow for approval of site pages

In May of last year I wrote a post which showed how you could implement approval of modern pages in SharePoint using Flow. That post was written before the edit experience implemented the Submit for approval button.

image

While the built-in approval is nice, Flow approval provides easy to use actionable messages which makes approving that much easier – no need for the approver to visit the page library to actually approve the item.

In my previous post I added a step to check for the Pending status of the page before invoking a Flow approval action in order skip the Draft and Approved states which should be ignored for the Flow itself. This means Flow will trigger more than actually needed – but that was the way to go last year.

Seems the SharePoint triggers have now been updated to support trigger filters, which means the steps can be optimized a bit.

Click the ellipses (…) on the trigger and pick Settings.

image

In the trigger conditions settings add the following to trigger only for items which are awaiting approval.

@equals(triggerBody()['{ModerationStatus}'],'Pending')

image

In order to use the content approve action you still need to get the correct ETag, which means the Get file metadata action has to stay.

A simple auto-approve Flow would look like below.

image

Happy Flowing!

Tuesday, August 6, 2019

Search nugget - Grouping property restrictions within a KQL query

image

Figured I’d alert you guys to a small nugget I was made aware of, and which I have officially documented at https://docs.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference#grouping-property-restrictions-within-a-kql-query.

The gist of it all is that you can now use parenthesis on property queries.

<Property Name>:(<Expression>)

As an example:

author:"John Smith" AND author:"Jane Smith"

can be rewritten as:

author:("John Smith" "Jane Smith")

The other cool side effect of adding () around the property value is that the term(s) will be lemmatized. The query title:page return matches with the exact term page only, while title:(page) also return matches for the term pages.

Head over to the docs to read all about it and check out some more complex samples. Start adding those parenthesis, and may the search be with you!

Note: Works for SharePoint Online and SharePoint 2019 only.

Tuesday, June 11, 2019

SharePoint Search Query Tool v2.8.4

Photo by Jason Wong at Unsplash

Get it at https://github.com/SharePoint/PnP-Tools/releases

Not a lot happening for this version - mainly UI improvements and support for query history.

Happy searching!

Friday, June 7, 2019

PnP Modern Search Web Parts June 2019 release is out

Get it at https://github.com/SharePoint/sp-dev-solutions/releases/latest

Modern Search Web Parts v3.4.0.0

pnp-react-search-refiners.sppkg
Changes
  • Updated to SPFx v1.8.2
  • Added query language setting
Fixes
  • Translations
  • Improved loading placeholders
  • Improved hash paramater change handling

Modern Search Custom Renderer v1.0.1.0

react-search-refiners-renderer.sppkg
  • First binary release
  • Includes example custom code renderer when Handlebars is not enough