All posts in Troubleshooting (SP 2016)

Proper way to handle workflows that throw a Microsoft.Workflow.Client.ActivityValidationException

I had to build a fairly complex workflow not long ago.  The workflow was built in SharePoint Designer 2013 and had a lot of moving parts to it.  So many, that when I went to publish it I received the following error message: “Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors: Activity “SomeXActivity” has 65 arguments, which exceeds the maximum number of arguments per activity (50).”  This error message is actually telling us that our workflow has too many variables within it.  Basically, this is happening because when the workflow is running the Workflow Manager has to manage more 58 (in my case) variables.  Workflow Manager only allows there to be 50 variables in the workflow… by default.

Read more

JavaScript files not Updating in Site Assets or other SharePoint Libraries

So ran into a very weird issue.  I had just finished patching our Dev and Test servers to the November 2017 CU.  And after this occurred, any updates to solutions using JavaScript injection was not working.  I’ll describe the problem in more detail here right away, but I want to make sure I give a call out to Trevor Seward.  Trevor blogs from The SharePoint Farm and kudos goes to him for pointing me at the Blob Cache (but I am getting ahead of myself).

Read more

SharePoint People Picker Error – Item cannot be more than 256 characters.

Had a colleague ask me the other day if there was a limit on the People Picker control in SharePoint.  Reason being is that she had a Person field setup to accept multiple users and had a group that was constantly getting the error “Item cannot be more than 256 characters” when trying to enter the users.  After a bit more digging, found out they were using a list of about 20 people or so and then just pasting them into the people picker box.  They had everything correct with semicolon separators and everything, but kept getting that error.

SharePoint People Picker Error - Item cannot be more than 256 characters.

Read more

Unable to Add Existing Site Columns to Content Types in SharePoint

While deploying a new solution to our test environment for my client the other day I found that I was unable to add existing site columns to content types within the SharePoint site I was working in.  No real reason given.  As you can see from the screenshot below the GUI wasn’t much help:

Unable to Add Existing Site Columns to Content Type - GUI Error

However, as always SharePoint provided the handy-dandy correlation id.  Using that I was able to get a great deal more information on the problem.

01/03/2017 13:18:07.08 	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	8nca	Medium	Application error when access /_layouts/15/fldpick.aspx, Error=No two choices should have the same ID   at Microsoft.SharePoint.ApplicationPages.ChoiceComparerWithDefaultGroup.Compare(PickerItem c1, PickerItem c2)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 de...	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08*	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	8nca	Medium	...pthLimit)     at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08 	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	Runtime                       	tkau	Unexpected	System.ArgumentException: No two choices should have the same ID    at Microsoft.SharePoint.ApplicationPages.ChoiceComparerWithDefaultGroup.Compare(PickerItem c1, PickerItem c2)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections....	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08*	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	Runtime                       	tkau	Unexpected	...Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08 	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	ajlz0	High	Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: Failed to compare two elements in the array. ---> System.ArgumentException: No two choices should have the same ID     at Microsoft.SharePoint.ApplicationPages.ChoiceComparerWithDefaultGroup.Compare(PickerItem c1, PickerItem c2)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, ...	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08*	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	ajlz0	High	...Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit)     at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)     --- End of inner exception stack trace ---     at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)     at System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer)     at Microsoft.SharePoint.WebControls.GroupedItemPicker.GetDataString(StringBuilder sb)     at Microsoft.SharePoint.WebControls.GroupedItemPicker.Render(HtmlTextWriter writer)     at System.Web.UI.Control.Render...	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08*	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	ajlz0	High	...ControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at ASP._layouts_15_fldpick_aspx.__Render__control16(HtmlTextWriter __w, Control parameterContainer)     at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at ASP._controltemplates_15_inputformsection_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer)     at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)     at System.Web.UI.Cont...	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08*	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	ajlz0	High	...rol.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)     at Microsoft.SharePoint.WebControls.AjaxDelta.RenderChildren(HtmlTextWriter output)     at System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer)     at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)     at Microsoft.SharePoint.WebControls.AjaxDelta.Render(HtmlTextWriter writer)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)     at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)     at System.Web.UI.HtmlContr...	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08*	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	ajlz0	High	...ols.HtmlContainerControl.Render(HtmlTextWriter writer)     at Microsoft.SharePoint.WebControls.SharePointForm.Render(HtmlTextWriter output)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)     at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection ...	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08*	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	ajlz0	High	...children)     at Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.RenderChildren(HtmlTextWriter writer)     at System.Web.UI.Page.Render(HtmlTextWriter writer)     at Microsoft.SharePoint.WebControls.DeltaPage.RenderToBase(HtmlTextWriter writer)     at Microsoft.SharePoint.WebControls.DeltaPage.Render(HtmlTextWriter writer)     at Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.Render(HtmlTextWriter writer)     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.HandleError(Exception e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean include...	137fc79d-a097-403e-4c78-ff67da2e62e2
01/03/2017 13:18:07.08*	w3wp.exe (ServerName:0x087C)         	0x2D4C	SharePoint Foundation         	General                       	ajlz0	High	...StagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)	137fc79d-a097-403e-4c78-ff67da2e62e2

Specifically, the problem was: “No two choices should have the same ID“.  Looking at the stack trace you can see that it looks like SharePoint is looking at the fields that exist in the site.  This makes sense because it has to build that list for you to choose from doesn’t it?  I scanned through my list of site columns and noticed that for some reason I had two columns called “Hashtags”.  I am not entirely sure what this field is for, but I believe it is added with the Newsfeed.

Unable to Add Existing Site Columns to Content Type - Multiple Hashtags

So the next step?  Well let’s delete the extra column.  Attempting to delete via the GUI just resulted in a window that never provided a response, nor deleted the offending field.  Next onto PowerShell.  While getting the field object I found that the two fields actually existed with the exact same GUID.  So that’s where the error message above came from.  While deleting via PowerShell I got a bit further and received the message: “Site columns which are included in content types cannot be deleted“.   I didn’t have a content type sitting there with Hashtags within it, so ran a script to go through each content type and to look for the field.

There were two hidden, system content types Project Policy and System Media Collection that contained the site column.  I did a few things to try and remove the site column from the content types, but I am not going to outline here because I don’t want to give any of you ideas (they aren’t something you want to do in a production environment and they didn’t work anyways).  Needless to say, I did everything I could think of but I could not remove the extra field from the sites.

Placed a call with Microsoft to see if they had any suggestions.  Apparently, according to the support engineer I worked with, Microsoft has seen this before.  Nowhere in the vast interwebs did I find this information.  One reason for this post is for prosperity ;-).  The fix is actually really simple.

Removing the Extra Field

Microsoft provided me with the feature definition of the Hashtags field.  The solution was to install the feature into the farm, activate the feature on the sub sites that had the Hashtags field existing within (whether they had the double instance or not) and then disabling the feature within the site.  Finally, we removed the feature from the farm as well.  I will provide that feature definition in this post, but want to make something very clear.  I did not create this, nor do I provide any warranty or take any responsibility if applying the solution causes instability in your farm.

You can download the feature here.

To apply the feature to correct your farm, follow these steps.

  1. Extract the zip file and place the MMSField folder in the directory: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\FEATURES.
  2. Open a SharePoint PowerShell window and run the following command:
Install-spfeature -path MMSField
  1. After the feature is added to the farm run the following script to check each sub site within your site collection to add and remove the feature (this step will force the system to remove the field and re-add it properly).
$spSite = Get-SPSite <URL>

foreach ( $spWeb in $spSite.AllWebs)
{
    $spField = $spWeb.Fields['HashTags']
    if ( $spField -ne $null )
    {
        Write-host $spWeb.url, $spField.Title
        Enable-SPFeature -Identity MMSField -Url $spWeb.url -Force -Confirm:$false
        Disable-SPFeature -Identity MMSField -Url $spWeb.url -Force -Confirm:$false
    }
}
  1. Remove the solution from the farm by running the following command:
Uninstall-spfeature -identity MMSField

Once this is complete you will have removed the extra instances of the HashTags field and can now add site columns to your content types without issues.

 

Thanks for reading!

Playing Further Outside Your Sandbox: Advanced Concepts in SharePoint BCS – Slide Deck

Hi everyone,

On October 20, 2016 I had the honour of taking part in the Collab365 Global Conference.  At this conference I presented my session on Advanced Concepts in SharePoint BCS.  I forgot to provide the slide deck to the Collab365 team prior to the conference.  I have posted the slide deck here.

Playing Further Outside Your Sandbox: Advanced Concepts in SharePoint BCS slide deck.