Master Page issue : The base type is not allowed for this page. The type is not registered as safe


Ever faced a scenario where you edited a SharePoint master page with SharePoint designer and suddenly the whole site is down with an error message

The base type is not allowed for this page. The type is not registered as safe

Well, recently i faced the same issue and fortunately there is help out there to fix and bring everything to normal. Solution is to re ghost the master page or in other words reset to site definition.

  1. Navigate to Site Settings.
  2. Under Look and feel find and navigate to Reset to site definition, and as the url suggests(_layouts/15/reghost.aspx).
  3. Paste the URL of the master page, from the master page gallery.
  4. Click reset to confirm.

Once done, the error should be gone and you site should be back up.

The email message cannot be sent .make sure the email has a valid recipient

Ever tried to send emails using CSOM using

and got an exception “The email message cannot be sent .make sure the email has a valid recipient“.

The reason is the ClientContext, you are passing to the function. Make sure the sharepoint site with which you created the Client Context has the Mail Recipient listed in the All People Group. To check that,

Navigate to [Site_Url]/_layouts/15/people.aspx?MembershipGroupId=0

and make sure the Email To user is listed in the group.

For more info Refer this .

Activate Publishing features using CSOM

After scouring through the internet and some trial and error, here it is.

You can find the GUID for the feature here .


NavigationTerm – Set Custom Properties NavigationTerm – Managed Metadata


Ever tried to set custom properties for the terms in your site navigation. Recently i tried the same but ended up searching for a while, after a lot of playing around , found a way to set custom properties. Following snippet will create a new term, set the target url , catalog target url and also set a custom shared property.

As you can see NavigationTerm has a method to get the underlying term and then from there it’s straight forward.

Hope this helps.

ews-Id is malformed

Ever tried to get tasks or emails from exchange using ews and faced this weird exception id is malformed. In my case, i had a http get to my ews method which accepted the id as a query string and id contains some special characters like +, / , = .  and all the + characters were replaced by spaces during the http get call. a example id will look like this.

So, it’s very important that you replace the + with %2B while making the get call.

so , whenever you get this error chances are some of the special characters in the id are missing. Taking care of that should solve this exception.

Happy coding…

Sharepoint fields in page layout

Following snippets will help you add different types of sharepoint fields into your page layout.

  • Text Field

  • Note Field

  • Taxonomy field

  • DateTime field

  • RichHtml Field

  • Image Field


Access Complete Result Set in a Content Search Webpart


While using the Display templates for Content Search Web part, we may need to access the whole result set at once. I faced a similar scenario where I needed the Results as whole and group them based on a Managed Property.

Normally if you open the out of the box Item Template you can see in a number of Places ctx.CurrentItem which gives you access to the current Item and all of its Properties.


As I Mentioned I wanted all the Results not just the Current Item, The below Single Line of code can give you access to that in JSON Format

var Results = ctx.ListData.ResultTables[0].ResultRows;

That’s it and you are good to go and on your way to create great search experience for the Users.