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.
- Navigate to Site Settings.
- Under Look and feel find and navigate to Reset to site definition, and as the url suggests(_layouts/15/reghost.aspx).
- Paste the URL of the master page, from the master page gallery.
- Click reset to confirm.
Once done, the error should be gone and you site should be back up.
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 .
After scouring through the internet and some trial and error, here it is.
using (ClientContext ctx = new ClientContext(url))
var site = ctx.Site;
Web web = ctx.Web;
// Feature GUID for SharePoint Server Publishing Infrastructure
var siteFeatureId = new Guid("f6924d36-2fa8-4f0b-b16d-06b7250180fa");
// Fetaure GUID for SharePoint Server Publishing
var webFeatureId = new Guid("94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb");
var siteFeatures = ctx.Site.Features;
var webFeatures = ctx.Web.Features;
// Added timeout just in case if the operation timeouts
ctx.RequestTimeout = Timeout.Infinite;
siteFeatures.Add(siteFeatureId, true, FeatureDefinitionScope.None);
webFeatures.Add(webFeatureId, true, FeatureDefinitionScope.None);
You can find the GUID for the feature here .