Thursday, May 7, 2015

SharePoint products configuration wizard failed

Environment: SharePoint 2013 Foundation

Requirement: Uninstall existing SharePoint 2013 Enterprise and Install SharePoint 2013 Foundation

Issue: After uninstalling the existing SP2013 and successful 2013 Foundation installation, the installation failed during running SharePoint products configuration wizard. It failed at the step 8 of 9 throwing following error message.
Configuration failed.
One or more configuration settings failed. Completed configuration settings will not be rolled back. Resolve the problem and run this configuration wizard again. The following contains detailed information about the failure.
Failed to upgrade SharePoint Products
An exception of type Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException was thrown.  Additional exception information: Failed to upgrade SharePoint Products


As it turns out to be insufficient SQL Server database permissions. Also noticed that the SharePoint timer job was running with Network Credentials account.

Following are the steps involved to resolve this issue.
  1. In Central Administration Web site, click Security > Configure Service Accounts.
  2. In Credential Management section, select the Web application pool for your Web application.
  3. In the Select an account for this component section, select the service account that you want to associate with this Web application pool, or click Register new managed account to associate a new service account with this application pool.
  4. Click OK
  5. Update the SharePoint timer job service to run on the same service account.

Tuesday, March 24, 2015

Enable Auditing for a specific document library and list.

Environment: SharePoint 2013 Enterprise
  • Enable audit for a document library to get the number of times the document is opened
  • Enable audit for a list to get the total number of times the item is edited.
  1. Go to Document library > Settings > Library Settings
  2. Click Information management policy settings
  1. Click on Document under Content Type
  2. Provide the necessary details and select “Opening or downloading documents, viewing items in lists, or viewing item properties” under Enable Auditing
  1. Click OK
  2. Navigate to the list where you want to set the policy
  3. Click List Settings > Select Information management policy settings

  1. Select the List from the policy settings
  2. Provide the required details and select Editing items under Enable Auditing

  1. To view the report, navigate to the top level site and Site Settings
  2. Select Audit log reports under Site Collection Administration

  1. Click Run a custom report under Custom Reports section

  1. Select the required events to view the report for

  1. Click Ok
  1. Click on “Click here to view the report”

Note: Site collection administrators page views or edit are not tracked.

Wednesday, March 18, 2015

Create and associate multiple content types for a library

Environment: SharePoint 2013
Requirement: Create multiple content types for a document library to have different metadata/columns.
Introduction: The following steps are to create sample content types to store Budget and Invoice details in a document library.
Create a site content type named ’Budget’. The parent content type can be selected based on the requirement. For example, if you are settings this for a document library then use Document Content Type as parent and if you setting this for a list, then select List content type.

Add columns that are specific to the created content type.
Create another content type named ‘Invoice’
Add columns that are specific to Invoice content type.

Navigate to the document library where you want to associate this content type.
Click Library > Library Settings > Advanced Settings and allow management of content type.

Associate the Budget and Invoice content types to the library in Library Settings page.

After associating the content types, you can see the content type column when you add a new item in the document library. The column that are created for each content type will get displayed based on the 
content type you select.

Upload document and submit metadata for different content types.

Monday, February 23, 2015

Programatically increase security validation timeout for a web application in Sharepoint

Environment: SharePoint Server 2013

Requirement: Programatically increase security validation timeout for a web application in SharePoint

Solution: The following line of code will set the Web Page Security Validation expiry to 60 minutes

   SPWebApplication webApp = SPWebApplication.Lookup(new Uri("http://webappURL/"));

   //Use TimeSpan constructor to specify Days, hours, minutes, seconds
    webApp.FormDigestSettings.Timeout = new TimeSpan(1, 0, 0); 

  //Save the changes 

NoteYou'll get access denied error when the above code is executed within RWEP as it runs the code under the Application Pool account of the your web application. You need to run this code with farm account as the SPWebApplication is stored in config database. Use SPUserToken and farm account to run this code.

Wednesday, February 4, 2015

OpenSSL - No such file or directory

Scenario: Trying to convert csr certificate to crt using OpenSSL and getting following error
Command used: OpenSSL> x509 -req -in server.csr -signkey server.key -out server.crt

Loading 'screen' into random state - done
server.csr: No such file or directory
error in x509

Provide full path for both .csr and .key file to run this command successfully.

Sunday, January 4, 2015

Unable to add iframe in Content Editor WebPart SharePoint 2013 & IE 11

Using SharePoint 2013, IE 11

Issue: Cannot add iframe in Content Editor WebPart. Source page added in iframe is not getting displayed in IE 11. Works fine in Firefox and chrome browsers.

Script used: <iframe  id="iFrameBox" src=""></iframe>

Resolution: Add the script to load the source file on document ready function.

<script language="javascript" type="text/javascript">


<iframe  id="iFrameBox" src=""></iframe>

Tuesday, November 25, 2014

Too many characters in character literal

Issue: Getting "Too many characters in character literal" error when try to build a SharePoint project. Error in the following line of code in application page
Assembly Name="$SharePoint.Project.AssemblyFullName$"

Cause: Since the SharePoint project is a sandboxed solution, Sandboxed solutions do not support the application pages.

Resolution: Fixed it by changing the solution from Sandbox to farm.