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


Renaming SharePoint Document Set Programmatically

When renaming document sets in code, it needs to be done in the same way as renaming folders.

You can’t just change the Title, you’ll need to change the Name value as well, otherwise the document set / folder name remains the same.

Continue reading

Setting SharePoint New Form’s User Field using JSLink

When creating a new item in NewForm.aspx, we can add a custom JSLink script to the form web part to automatically pre-populate user fields, either defaulting to the current user or picking up another user through the REST API.

The script below sets one user field (Owner) to the currently logged in user, and another user field (Approver) to a specific user based on email.

Continue reading

Updating Site Icon URL in SharePoint Online

By default, the SharePoint site icon on the top left of the default master pages will redirect users to the landing page of the current site they are in.


However, it’s sometimes useful for that site icon to be used to redirect back to the site collection home page instead.

We can do this with a bit of JavaScript. Assuming you already have a JS file (global.js in the example below) that is embedded as a User Custom Action, the following code should update the site icon’s URL on all pages: Continue reading