Author Archives: Daniel

InfoPath Form cannot be published because sandboxed solutions are not enabled

Did you come across this popup telling you that “The Form template cannot be published to the server” because “Sandboxed solutions are not enabled on the SharePoint server farm” and that you should “contact a site collection administrator or publish the template as administrator-approved form template” when working with InfoPath? If you don’t know what that means then you have probably (accidentally?) clicked one of the buttons in the Developer-tab which have added managed code to your form, and now you have a form which you can’t publish anymore.

The fix is easy… Continue reading

StickyHeaders 3.0 Released

StickyHeaders 3.0 for SharePoint 2013 on-premises and SharePoint Online has been released.

I spent a lot of time to get rid of the bugs in previous versions and I came up with greatly simplified code that makes a lot of things better than before. One of the biggest changes is that the sticky headers now keep their full functionality in quick edit mode.

Furthermore, the performance has been dramatically increased and all calculations which are necessary to figure out whether the header shall be sticky or not take now less than 1ms for each scroll step on a normally powered computer (especially important when smooth scrolling is activated). You can grab the script directly from the related Product Page

Should you have any questions, problems or bug reports please use the comment section on the Product Page or the Forum.

Fix “User ‘xxx\xxx’ has a manager” when using the Add-SPProfileLeader PowerShell command

The SharePoint Health Analyzer reported that “People search relevance is not optimized when the Active Directory has errors in the manager reporting”. So in order to fix this problem I wanted to execute the ‘Add-SPProfileLeader’-command on our CEO.

SharePoint, however, stated that “User ‘domain\ceo’ has a manager.”
But in order to be ‘Profile Leader’ the account must not have a manager!

PS C:\Users\sp_farm> Add-SPProfileLeader $SPSAP -Name domain\ceo
Confirm
Are you sure you want to perform this action?
Performing operation "Add-SPProfileLeader" on Target
"domain\ceo".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):Y
Failed. User 'domain\ceo' has a manager.

I checked the AD and to my suprise the Manager-attribute was empty. No matter what I tried, I couldn’t fix this issue until I checked what’s going on in SharePoint’s database itself.

So, here is how I fixed the issue:

Continue reading

Convert Script-Editor-Webpart-Textarea to a real code editor with CodeMirror.js

I use the Script Editor Webpart very often and what always bothers me is that there is no proper code formatting in the textarea. So after some messing around with the CodeMirror-editor (a text editor implemented in JavaScript), I came up with a piece of code which will convert the textarea of a Script Editor Webpart to a real code editor including syntax-highlighting, proper indenting, fullscreen-editing, search, etc..

Continue reading

QuickTip: Find out whether the page is in edit mode or not

You just want to run a script if the page is in edit mode or just execute if it is not?
Use this little function (requires jQuery) to check whether the page is in edit mode or not:

function checkIfEditMode(){
	return ($("#MSOLayout_InDesignMode").val() || $("#_wikiPageMode").val()) ? true : false
}

This script will work Web Part pages, SharePoint Publishing pages and Wiki pages.

QuickTip: SharePoint Attachment Field in List Forms


To show the attachment field in the form as in the above screenshot without the need to click the ‘Add attachment’-button in the ribbon, simply edit the form and put the script below into a Script Editor Webpart. This Script requires jQuery.

jQuery(document).ready(function(){
	//Get all the ribbon buttons from the action-group
	var $ribbonAttachButton = $("#Ribbon\\.ListForm\\.Edit\\.Actions a")
	//If the 'Add Attachment'-button is the only button in the group then hide the group, otherwise just hide the button 
	$ribbonAttachButton.length == 1 && $ribbonAttachButton.closest("li").hide() || $ribbonAttachButton.hide()
	//Get the iportant elements of the hidden attachment field
	var $attachElements = $("#csrAttachmentUploadDiv > #partAttachment > table > tbody > tr:eq(1),#csrAttachmentUploadDiv > #partAttachment > table > tbody > tr:eq(4)")
	//Get the 'OK'- & 'Cancel'-button
	var $attachButtons  = $attachElements.find(".ms-attachUploadButtons")
	//Insert an empty cell in order to adjust to the form's layout
	$("<td></td>").insertBefore($attachButtons)
	//Align buttons to the left
	$attachButtons.css("text-align","left")
	//Remove some margin and rename the 'OK'-button
	$attachButtons.find("#attachOKbutton").css("margin-left",0).val("Attach")
	//Adjust the fields label to match the rest of the form, adjust the height
	$attachElements.find(".ms-formlabel").html("<h3 class='ms-standardheader'>Add Attachments</h3>").css({"height":"auto","width":"auto"})
	//Make the file-selector bigger
	$attachElements.find("#onetidIOFile").addClass("ms-longfileinput")
	//Move elements to the end of the form table
	$attachElements.appendTo($("#part1 > .ms-formtable"))
})

Starting Workflows (SP 2010 WF Engine) With 1 Click

It always annoyed me that if you want to start a SP2010 workflow manually from the items context menu or the ribbon you are redirected to the page where you have to click yet another button to finally start a workflow.

But there is an better way. With a small script and with the help of the SPServices JavaScript library you can start workflows with just one click.

Continue reading

Change the Access Denied message

If you don’t have sufficient permissions to access a SharePoint resource you are presented with one of three messages. If you have Access requests activated for the site you will see something like this:


From my experience many people tend to think that this is just a plain error message and click it away, followed by an email with the question to please provide the necessary permissions to access the resource. They don’t *really* realize (or know) that they can send a request with a custom message which the admin will read and cause him to react accordingly. That means that the big advantage of sending a request in the context of a resource stays untapped and the email odyssey begins in which you (the admin) try to figure out what the user has just clicked right before this message appeared.

Continue reading

SharePoint Server 2013 SP1 released

Microsoft has just released the first Service Packs (SP1) for their new 2013 Office and SharePoint Products. The new Service Packs contain new fixes as well as the Cumulative and Public Updates from December and January, respectively.

The fixes that are included in the Service Pack for SharePoint Sever 2013 are as follows:

Continue reading

(Updated) Sticky Headers for SharePoint 2013 – v2.0

Update 4th of March, 2016: This script has its own Product Page now and all future updates will be posted there. Should you have any questions, problems or bug reports please use the comment section on the Product Page or the Forum.

A limitation of the StickyHeaders script in version 1.0 is that it is not working in Quick Edit mode. Therefore I updated the script and released version 2.0 which is now also working in Quick Edit mode. You can download the script at the end of this post.

Version 2.0 also eliminates a few bugs that showed up from time to time. While the sticky headers are fully functional in list views, the sticky headers lose their functionalities in Quick Edit mode, but I hope that I can address this issue later (I already got an idea how to do it, so check back a bit later if you need these functions).

Continue reading