Posts

Showing posts from November, 2011

Add Safe control entry in web.coinfig using SPWebConfigModification Class

SPWebConfigModification Class : Holds modifications that are made to the web.config. Following example helps you to add the safe control entry on feature activation. public override void FeatureActivated( SPFeatureReceiverProperties properties)         {             try             {                 SPWebService contentService = SPWebService .ContentService;                 contentService.WebConfigModifications.Add(GetConfigModification());                 // Serialize the web application state and propagate changes across the farm.           ...

Why we need a AllowUnsafeUpdates.

AllowUnsafeUpdates is a property of SPSite SPWeb If user do't have any permission to update the data. So we run the code with special permission for that we use RunWithElevatedPrivileges block, by using this code user update the item on the behalf of system account, for that we need to  Set AllowUnsafeUpdates   to true to disable security validation on Update(). This is request if persisting anything within RunWithElevatedPrivileges. Any exception, handled or otherwise, sets AllowUnsafeUpdates to False.

SharePoint2010 Replace AccessDenied.aspx, Confirmation.aspx and other page with our own custom page

In sharePoint2010, we can replace the list of the following page with our own custom page. AccessDenied.aspx Confirmation.aspx Error.aspx Login.aspx ReqAcc.aspx SignOut.aspx WebDeleted.aspx For replace the default list of pages as mentioned in above. We have a class SPWebApplication Under namespace Microsoft.SharePoint.Administration. SPWebApplication class have a SPCustomPage enum which has a following values. public enum SPCustomPage         {             // Summary:             //     Specifies that no page will be replaced with a custom page.             None = 0,             //             // Summary:   ...

SharePoint2010 : The root of the certificate chain is not a trusted root authority

Image
Problem : The root of the certificate chain is not a trusted root authority. Event Log Error An operation failed because the following certificate has validation errors:\n\nSubject Name: CN=<Certificate URL>, OU=Domain Control Validated, O=<Certificate URL>\nIssuer Name: SERIALNUMBER=07969287, CN=Go Daddy Secure Certification Authority, OU=http://certificates.godaddy.com/repository, O="GoDaddy.com, Inc.", L=Scottsdale, S=Arizona, C=US\nThumbprint: xxxxxxxxxxxxxxxxxxxxxx\n\nErrors:\n\n The root of the certificate chain is not a trusted root authority. Main problem is your SSO Application unable to make a trust with SharePoint 2010 Site. Common mistake: Most of developer while implementing the SSL on SharePoint Site they only include the main Certificate to SharePoint Security "Manage Trust"  i.e. (<Site URL> ). SharePoint Site unable to make the trust between the SSO Site. Solution : You need to first see the hierarchy of the certificate. ...

SharePoint 2010 Update Default List View By Code

SharePoint 2010 Create List view using Code. Open visual studio Create a console Application give it name and Add “Microsoft.SharePoint” Ref. to your project. using  System; using  System.Collections.Generic; using  System.Linq; using  System.Text; using  System.Xml; using  Microsoft.SharePoint; namespace  SharepointForDeveloper_AddView {      class   Program     {          static   void  Main( string [] args)         {              if  (args.Length < 2)             {                  Console .WriteLine( "Missing Parameters 1. <ListUrl> 2. <XmlFile Path>" );    ...