Skip to main content

Posts

Log4Net Custom Logger for SharePoint 2010 and 2013 (With Attached working Code)

What is the Problem The big problem in SharePoint 2010/2013 to write the custom error to log files, whenever the error comes, the developer grab the associate correlation GUID and see the associated error in 14 hive folder. The log file also contains the bunch of other information as well. It would be great if somehow I can develop the custom logging feature for our project that is only specific to my project. It will reduced my effort and it would be a big win for me as a developer. Solution we would able to solve this problem by using 3rd party open source DLL “log4net” . We have written some custom classes to override the base function that would help us to write SharePoint logs into the 14 hive. These classes contain the logic for generating the logs under the same location, where the SharePoint logs are generated i.e 14 hives under different folder (This will help to get the exact information during the error and trace). Solution Dependency Log4Net Dll Important C...

CryptographicException : Keyset does not exist (issue fixed)

One of our project(SharePoint) requirements, we need to use the certificate to encrypt and decrypt the data by using the public and private key. So the code implemented on the DEV working fine, but issue comes when code deployed on the other servers. The error was “ Keyset does not exist ”. The base exception class of this error is “ CryptographicException ”. CryptographicException : Keyset does not exist 0(issue fixed) RSACryptoServiceProvider rsaEncryptor = ( RSACryptoServiceProvider )certificate.PrivateKey; This exception comes when the application pool account doesn’t have access to read the certificate private key. For this we would required to give the full access to the particular certificate. Followings are the required steps to fixing this issue. Solution Application Pool account doesn’t having an permission to access the private key value Steps 1.   Login to server Press Ctrl+R type to   MMC. 2.   File -> Add or remov...

Nintex Object Model 2013: Property Editors

Deep dive during my practice hours found an interesting way of making Nintex control more customizable and yet not getting a much time to implement the custom property editor.  In " Nintex Form Object Model 2013: Render various types of properties " this post I had described the various type of properties that we can create using Nintex object model. To customize the properties more we have an another option called the PropertyEdior. The PropertyEditor is the control that we render in side the control.This is a property of the ControlPropertyInfo class.  The PropertyEdior option takes the GUID of control. This control  must be inherit with PropertyEditorBase abstract class and implement the following methods & properties. UniqueId (Property)  HandleControlPropertyDesignerPageLoad (Method)  HandleControlPropertyDesignerCreateChildControls (Method)  JqueryLoadInitializer (Method) The various type of “Nintex property” editors used by the...

SharePoint 2010 Hide Ribbon using JQuery in "EnabledScript"

Problem Understanding: In SharePoint ribbon control there is “EnabledScript” parameter that used to enable and disable the icon from the ribbon based on the condition logic in your method. So the requirement is to hide the button from the ribbon instead of disabled it. Requirement: Hide the button from the ribbon instead of disables it. Solution: In SharePoint ribbon control there is “EnabledScript” parameter that used to enable and disable the icon. So in this function I decided to hide the ribbon control using JQuery. Here comes the problem the ID of the icon is     “ DATA.SharePoint.Ribbon.NewControlInExistingGroup.NotifyLarge ” and it contains the “.” So to escape the “.” We required to add the “\\” in front of “.”. Implementation: So the following Script that I used to hide the ribbon icon. In this code I checked the controlexistId control existence and based on the logic I hide the icon. EnabledScript = "javascript:EnableDisable() function EnableDisa...

Nintex Object Model (Required Field validator to custom properties)

Background: It almost take 2 days to find the way to apply the required field validator to the custom control properties. So I decided to share with this information to all other fobs working with Nintex object model. Goal: Apply Required Field validator to custom properties. So apply the required field validator we need to put the following code at the top of the properties attribute section. Required (ErrorMessageResourceType =  typeof (Core), ErrorMessageResourceName =  "ValidationFieldRequired" ) So the full code would be goes like this. The marked yellow are required parameters to make the fields to required.  [ControlPropertyInfo(ResourceType = typeof(Core), DisplayName = "MyRrequiredField", GroupName = "Rrequired", DisplayOrder = 6, Required = true, ChangeAction = ControlPropertyChangeActionType.DoNothing, TextMode = PropertyTextMode.MultiLine), Required(ErrorMessageResourceType = typeof(Core),...

Nintex Form Object Model 2013: Render various types of properties

Goal: Requirement is to create the various types of properties like Textbox & checkbox and dropdown list in Nintex object model. Background: To read about the Nintex forms object model , please read this blog. Steps: To achieve above functionality only we required to work on the ControlProperties class. By taking the ref. with this blog Nintex forms object model . The textbox already already implemented on the ref. post. So render the dropdown and check box only required to add the following lines of code in the ControlProperties class file. so below is the code using System.Runtime.Serialization; using Nintex.Forms; using Nintex.Forms.FormControls; using System.Collections.Generic; using Nintex.Forms.Resources; namespace CustomControl {     public class ControlProperties : BaseBindableFormControlProperties     {         /*Render Text box list*/         [DataMember, ControlPropertyInfo( ...

Nintex Custom Ribbon Control 2013 - Implementation Example (Custom Action)

Goal: To create the custom action that going to display the button at Nintex form setting ribbon. Feature Scope: Site Identify the location: Using the IE developer tool you can identify Ribbon group.  Location: Nintex.Forms.SharePoint.Ribbon.FormDecustomer.FormTab.CommitGroup.Controls._children CommandAction: Display the Popup to show create filed form: ' _layouts/15/fldNew.aspx Element.xml < CustomAction    Id = " Custom.SharePoint.Ribbon.NewControlInExistingGroup "    Location = " CommandUI.Ribbon " Sequence = " 20 " >     < CommandUIExtension >       < CommandUIDefinitions >         < CommandUIDefinition Location = " Nintex.Forms.SharePoint.Ribbon.FormDecustomer.FormTab.CommitGroup.Controls._children " >           < Button Id = " Custom.SharePoint.Ribbon.NewControlInExistingGroup....