Uncheck Send an Email Invitation in SharePoint Grant Permissions Dialog

In SharePoint 2013, when you want to grant permissions, this dialog opens, with the secret “Send an email invitation” checkbox hidden in the Options section.

Share Dialog

Most of the time, I would uncheck that before sharing, to avoid email spams.

One of our clients wanted it unchecked by default, so that users don’t have to always remember to manually uncheck it to prevent spams, if they even knew it existed there in the first place.

You could easily default it to uncheck by updating the OOTB layouts page in the 15 hive at TEMPLATE\LAYOUTS\AclInv.aspx, and updating the chkSendEmailv15 asp:CheckBox control and setting Checked=”false”.

But we don’t want to do that! Updating OOTB components is not recommended and we like to stick to Microsoft best practices.

So we’ll do it the fancy pants way of using JavaScript embedded as a Script Link in a Site Collection User Custom Action.

Continue reading


SharePoint Search Expired Claims Cookie

We had an issue with a client where their SharePoint search crawls were periodically crawling successfully, but then on other subsequent crawls show a lot of warnings, saying “The claims cookie used by the crawler has expired.”

Expired Claims Cookie

For this web application, we had the Default zone set up with Windows Authentication for the search crawler, and an ADFS Trusted Identity Provider for users to log in through a custom login page.

The client also had a requirement where logins have to expire after an hour, so the CookieLifetime setting in the Security Token Service Config for the farm had been modified to 1 hour from 5 days.

Continue reading

PowerShell to Insert Field to List View at Specific Location

Added a new field (AddressLine1) to a list, and needed to display the field in all list views. It needed to always display before another field (AddressLine2).

Script below loops through all views of a list, and if the AddressLine2 field exists, it will add AddressLine1 just before it.

Note: Can’t use ForEach loop to go through each list view as the .Update() will throw an error, due to restrictions in updating collection items while enumerating.

Continue reading

Reordering SharePoint Fields using PowerShell

The order in which fields are displayed in the New, Edit, and Display forms for a list item is determined by the FieldLinks order of its content type.


The SPFieldLinkCollection has a handy Reorder method that we can use to set the order of the fields, using their internal names

The script below does this through PowerShell:

Continue reading