PowerAppsPuzzle: Sorting SelectedItems

Let’s take the scenario where you have a ListBox in a PowerApp that contains sorted information – either alphabetically or numerically, doesn’t matter – similar to the following:
The user selects 1, then 2, then 4, and all is good, however you may notice that sometimes the values are not sorted. You may receive the values out of order like: 4,2,1 or 2,4,1. The reason for this is that the values are in order that they are selected and not necessarily in the order that they exist in the list. For example, if the user selects 1, then 2, then 4, and then deselects 2 and selects 3, the value list will result in 1,4,3.

You can easily demonstrate this using a Label and the Concat() formula to see the results of selecting different items:



In order to preserve the sequential or sorted order of the values selected, one can use the SortByColumns() formula as the first parameter to the Concat() formula as shown below:


Hope this helps!

Friday Thought of the Day

This is over a year old, but it was the first time I’d seen it… it’s a whimsical interview with Satya Nadella (CEO of Microsoft Corporation) by the Wall Street Journal. It’s only ~2 min long, so if you haven’t seen it, then it’s worth the time for a look. The very last question (1:50 mark) is what struck me the most.

“Believe in yourself more than you do”

It sounds a bit hokey, but I’d seriously like to get that tattooed on the inside of my forearm. (and yes, I have a few others so it wouldn’t be a first) Being critical of one’s self is human nature, I think. And it helps to fine tune our ideas and actions to make them even better. Some of us take this a bit further — to an art form, if you will– and create more ways to doubt our own abilities. Remember a few key things:

  • You wouldn’t be here if you were not excellent at what you do
  • Trust those who believe in you that they believe you are more than capable for the task at hand
  • Believe in yourself more than you do

You CAN do this

Implementing Managed Tabbed Navigation with SharePoint – Part 1

Recently, I changed roles and have more opportunity to work in areas that have more of a development slant to them. One of my customers recently wanted to convert their Intranet portal into a more friendly navigation experience on SharePoint 2013. They also want it to be responsive, but we’ll tackle that later.

I’m going to break this post up into a series of posts due to the length and number of topics:

Part 1 – Basic overview of implementing Tabbed Navigation with SharePoint

Part 2 – Investigation into the necessary CSS classes and HTML structure for Tabbed Navigation

Part 3 – Explanation of the JavaScript to render the HTML from part 2

So in my discussions with the customer we arrived at a decision that they would be using Managed Navigation and they wanted it to be in a tabbed format similar to this:


I won’t get into Managed Navigation here, but suffice it to say that it’s a feature that was added to SharePoint 2013 that uses the Managed Metadata Service and terms that you define to provide navigation items. It’s highly dynamic and easy to change, if needed. SharePoint creates a control and adds it to the default master pages so you don’t really have to do much, but they aren’t very attractive out of the box.


There are a ton of ways to do any one thing with software development – some more efficient or better practice than others, but still a wide variety…this is simply the way I picked. Smile  I began by looking at Bootstrap as not only does it have easy to use classes right out of the gate for navigation (including tabs), it also makes responsive (the next thing we’d have to look at it) much easier as well. After searching around a bit for Bootstrap and SharePoint I happened to stumble upon some code from a fella named Tom Daly. He had already tackled a good bit of what needed to be done and code-reuse is a popular topic today, right?

Installing the code as downloaded from GitHub, we get a look like this:


Obviously this is not the result that any of us wants to see so using Tom’s code as a base, I had to tweak a little bit of the Javascript and some custom CSS to get the display that I wanted. The first thing that I wanted to do was to remove the out of the box Navigation using some custom CSS:

.ms-core-navigation, #DeltaPlaceHolderPageTitleInTitleArea, #DeltaTopNavigation {

That, at least, allows us to only see one set of navigation elements (and the ones we want, I might add). Next was to begin changing the type of navigation from Tom’s code from dropdown classes to using tabs. There are actually a lot of steps to this and that is why I’ll dive further into those steps in the next two parts to this series. I *highly* encourage you to review the code in Tom’s solution to understand the steps and ask questions in the comments. One of the important parts to understand is that using Tom’s code we make a call to the REST endpoint “/_api/navigation/menustate?mapprovidername=’GlobalNavigationSwitchableProvider’” and this returns an object containing the Navigation Nodes (all levels).

So stay tuned and watch for Part 2 of this series when I start discussing the CSS classes needed to get the layout that I wanted. (Including the somewhat embarrassing fact that my teenage son had to help me with part of it.)


CSS and Javascript


When Using SharePoint, Don’t Use $

Hey folks!

I ran into an interesting issue while onsite with a customer the other week and I thought maybe someone else could benefit from this. The scenario had to do with the Distributed Cache and we were trying to correct some issues that they had.

The basic steps were to Remove/Add the SPDistributedCacheServiceInstance using powershell (PS) in order to ‘fix’ it. When we executed the Add-* PS cmdlet we ended up seeing the following error:


This was most vexing as the user running the PS cmdlet was a Farm Admin and local admin on the server in question. I consulted with several of my peers when it occurred to one of them that the referenced path appeared quite interesting:


The actual user account was not test18172account, but was test$account. Now if you have done your homework, there is a specific supportability statement with regards to SharePoint service accounts:

Do not use service account names that contain the symbol $.

So there is a small bit of room for discussion about this since the article states “service account names” and in this scenario we weren’t using a service account. However, as it turns out this restriction apparently applies to accounts used running certain PS cmdlets.

As soon as we moved to another admin account that didn’t contain a $ everything worked as expected. So the morale of the story is to avoid using special characters in your account names — or at least $ (dollar signs).  🙂

Reposting the error in text for search-ability:

Add-SPDistributedCacheServiceInstance : Could not find a part of the path
At line:1 char:1
+ Add-SPDistributedCacheServiceInstance
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share…ServiceInstance:SPCmdletAddDist…ServiceInstance) [Add-
   SPDistributedCacheServiceInstance], CmdletInvocationException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddDistributedCacheServiceInstance

Help! I need QuickEdit!!

Hi all!  My latest scripting effort comes as a result of the 2010 –> 2013 migration from one of my customers. We should all know about the migration process (database upgrade, then site upgrade) and it was after the site upgrade that they were being informed that their QuickEdit options were disabled in *some of* their custom lists. Now this phenomenon has been discussed and talked about in many other blogs:



The request was multi-fold:

– Is there a way we can detect which lists will experience this problem?

I have not, as of yet, determined what causes this in some lists and not others, but for the purposes of this work we checked any custom list that had been upgraded to the 2013 UI.

– Is there an automated way we can correct it rather than manually navigating to each list?


So just to refresh the issue… In your 2010 environment, users could use Datasheet View to modify custom lists and it looked like this:

datasheet view 2010


As long as the site remains in 2010 mode after upgrading the content database to 2013, the functionality remains and is still available. However after upgrading the site to 2013, then Datasheet View is replaced by QuickEdit and in some cases (as with my customer) is disabled:

QuickEdit Disabled in 2013

You will also notice that the nice HTML5 UI is no longer here either.

To be 100% transparent, I didn’t do all the research on this issue. I simply provided the resultant script to fix it. What my customer found was that the issue affected all 2010 custom lists and after executing the site upgrade, the JSLink from their View had been set to ‘null’ or ‘empty’. In order to correct the issue, what they had to do was reset JSLink on their view to ‘clienttemplates.js’.

I’ve attached the script to this blog post, but the core of the logic is around enumerating through each list and each view of each list to check the value of JSLink. The script also have a report-only function – which is the default. If run in report-only mode, then no changes are made and only a list of the views and their corresponding JSLink values will be output.

The parameters for the script are:

Url – this represents the url of the web, site, or web application that you want to scan; Required

Scope – this represents the scope of the scan and can be one of the following: web, site, webapp; Required

Repair – this represents whether you want to repair the views that are found; Optional; default value is $false

Changing the Service Bus RunAs Account Password Changes VSS Credentials

Since I’ve been working in the area of Workflow Manager (WFM) as it relates to SharePoint and since WFM is ‘tied at the hip’, so to speak, to Service Bus one of my co-workers forwarded me some interesting information regarding Service Bus that I thought was worth letting you know about if if you didn’t already…

<wow, that was a long and I’m sure grammatically incorrect sentence>

Basically, my peer, Joe Rodgers, is a powershell nut and uses it for everything. He was writing some scripts for one of his customers and noticed that when he changes the password for his Service Bus RunAs account, that the credentials for the Service Bus VSS service also change to match that RunAs account. Initially when you configure SB along with WFM for SharePoint, the Service Bus VSS service is configured to use LocalSystem.

Before the change:


The script used:


After the change:


Notice that the script doesn’t mention the account name, but what happens is in the code for setting the password of the SB RunAs account it also takes those credentials and sets them on the Service Bus VSS service.

I don’t expect this to affect many of us, but it’s possible that this will affect you if you are using some product that hooks into the VSS writers.

Test-SPContentDatabase Reports Valid Web Parts as ‘Missing’

While working on a migration for a customer we were combing through the results of Test-SPContentDatabase in preparation for the migration efforts of taking their SharePoint 2010 content into a new SharePoint 2013 environment. We were systematically reviewing and repairing all the common errors that we found, like MissingFeatures, MissingSetupFiles, and MissingWebParts. It was the last of these that gave us a bit of a problem. After using the common scripts for removing these missing web parts, which normally show up as an error, these missing web parts were remaining quite stubborn.

Category        : MissingWebPart
Error           : True
UpgradeBlocking : False
Message         : WebPart class [8dd36a66-e8d0-c735-2173-b3cf93383598] (class [
                  _2010_VisualWebPartProject.VisualWebPart1.VisualWebPart1] fro
                  m assembly [2010_VisualWebPartProject, Version=, Cultu
                  re=neutral, PublicKeyToken=7552893a02bae51b]) is referenced [
                  2] times in the database [WSS_Content], but is not installed
                  on the current farm. Please install any feature/solution whic
                  h contains this web part.
Remedy          : One or more web parts are referenced in the database [WSS_Con
                  tent], but are not installed on the current farm. Please inst
                  all any feature or solution which contains these web parts.


The end result is complicated by a couple of factors:

  1. The version of SP2010 that I was working with was 14.0.4762.1000… yes, the RTM build
  2. The web parts that were being stubborn were sourced from Sandbox Solutions.

The combination of the above two items actually cause Test-SPContentDatabase to result in false negatives regarding these web parts…even after you remove the sandbox solution. Yes, folks you heard that correctly.. if you have the RTM build of SP2010 and remove your sandbox solutions that contain web parts, then Test-SPContentDatabase will still show false negatives for these web parts.

I did not test every build to find out exactly where it changed, but at some point before the release of service pack 1, Test-SPContentDatabase was altered to ignore sandbox solutions. So you no longer get an error on these web parts. There may or may not be another problem in that after removing the solution from the solution gallery and the web parts from the web part gallery that the reference still exists in the AllWebParts table, but I can neither confirm nor deny such theory at this time.. Smile

My final thoughts on this?

If you are upgrading SP2010 RTM –> 2013, then you can ignore missing web part warnings/errors from Test-SPContentDatabase as long as you confirm they are referring to sandbox solutions.