All posts in Development (SP 2016)

SharePoint Site Architecture – Flat, Deep or Something In The Middle

Hi recently had the privilege to do another presentation with Joanne Klein.  This time we built a presentation off of a post that she had written around whether we should use flat or deep structures with our site collections and sub sites or if we should have something in between when designing a SharePoint site architecture.  It was a lot of fun and we probably could have done entire presentation on just a portion of it.  Either way, I promised our attendees that I would post our slide deck.  You can find the slide deck here.  Thank you very much to everyone who attended.

 

Thanks for reading!

Best Practices in Waiting for a Value to Change in a SharePoint Designer Workflow

Back in October I did an overview of the different ways to wait for a change in a SharePoint Workflow.  You also have the option to wait for a certain time, there are two options which are waiting for a set duration or waiting until a set date.  Either of which are easy to control or set.  I am not focusing on these actions in this post, but just a quick note if you want the date to be dynamic when using wait until a date, then you will have to set the date you want in a workflow variable prior to setting the wait value.  Otherwise your date is going to have to be static and that’s probably not going to work for you in 99% of your workflows.

Today, however I want to discuss waiting for a value to change on the list your workflow is attached to.

Bit of a disclaimer: Why am I still talking about SharePoint Designer?  Why not Microsoft Flow?  Don’t worry, I have some Flow blogs planned.  However, Designer is still widely used and will be for some time.  I encourage others to use flow where they can, but remember that not everyone has access to that yet.  Designer is free and anyone with a SharePoint environment can make use of it.  Hence, I still see providing insight and knowledge on this product very important.

I have a bit of a TLDR here as you may be just looking for the answer, and not WHY it is occurring.  I strongly urge you to read the whole post to understand why things are the way they are and to make you a better person ;-p, but if you are in a hurry or think I talk\write too much, just click here to find out what you need to do.

Read more

SharePoint Saturday Vancouver 2017

This week I had the distinct privilege to present at SharePoint Saturday Vancouver.  I presented a search based session with Joanne Klein and a new presentation I just finished about using  PowerShell to make your day-to-day administration\usage of SharePoint so much easier.  As always, I had a great time presenting.  Had great interaction with the attendees of my sessions.

A huge thank you to the sponsors and to the Vancouver SharePoint Users Group.

As promised here are the slide decks for the two presentations:

Finding the Needle in a Haystack SharePoint Style: Search Concepts and Content Quality

Stop Clicking Your Mouse Button, We have a Script for That!

Fake a Required Field on a SharePoint List Form

As with so many things I write about recently I had a need to do something different at my client site.  This time I needed to fake a required field on a SharePoint list form.  The reason behind it was we had customized the form and had some fields that were required in some cases, but not all.  These fields could not be marked as required in the content type because then we would need to fill in default or bogus data into the fields and that wouldn’t look good so I decided to simply make the fields look exactly like a SharePoint required field without actually setting them up that way.

Fake a Required Field on a SharePoint List Form

This may already be documented somewhere, but I didn’t bother to look.  I thought the solution I came up with is pretty quick and clean so I wanted to share it.  I am basically just inserting the same <span> field that SharePoint does onto a label when the field is set as a required field.  Using JQuery I get the <nobr> control and then insert the <span> after.  Here’s the code to accomplish that:

/********************************************************************************************
*Function Name: displayAsRequired                 											*
*Parameters: $fieldTitle - Title of the field                								*
*Purpose: Makes a control appear as if it were required, without making it required in SP   *
/********************************************************************************************/
function displayAsRequired(fieldTitle) {
    var reqField = $(".ms-formlabel nobr").filter(function (){
        return $(this).contents().eq(0).text() === fieldTitle;
    }).after("<span title='This is a required field.' class='ms-accentText'> *</span>");
}

So you just need to pass in the field name (display name, not the internal name) to the function.  The code will find the corresponding <nobr> control on the form and update it to look like a required field.  Kudos to a comment Marc Anderson made in a blog somewhere about accessing the <nobr> field.  I would have done it a bit differently, but I liked the flow of the code in the comment he made.

Thanks for reading!!

Getting User Data from People Picker with JavaScript

Back in the SOM (Server Object Model) days it was pretty straight forward and well documented how to gather a user’s information from within a SharePoint form, or even go out and get it from SharePoint itself having just a single piece of information like email, login name or even just the user’s first and last name.  While there are techniques to doing this from the client side using CSOM (Client Side Object Model) or REST APIs what if you didn’t need ALL the user’s information and just needed a few important parts of it.  If the form you are working in has a people picker then you are all set.  Today I am going to show you all about getting user data from People Picker with JavaScript.

Read more