Wednesday, August 20, 2014

SharePoint trouble shooting - Remove orphan feature

In the ULS log, the following error message keep happening because the feature has been removed from the solution before the feature undeployed.

Feature definition missing for Feature <<feature display name>>' (Id: '2cf0c09e-157e-4d3b-aa61-fee768b489c9'; CompatibilityLevel: '15')

The following powershell script can be used to identity the orphan features,

$url = "<site url>"
$site= new-Object Microsoft.SharePoint.SPSite($url)
$site.WebApplication.Farm.FeatureDefinitions `
| where-object {$_.solutionid -ne '00000000-0000-0000-0000-000000000000'} `
| Sort-Object solutionid,displayname `
| ft -property solutionid,id, displayname,scope -auto > features.txt
$features = $site.WebApplication.Farm.FeatureDefinitions | where-object {$_.Scope -eq $null} | Sort-Object solutionid,displayname
$features | foreach {
 $id = $_.Id
}
$site.Dispose()

In codeplex, there is a good tool to remove the feature,
http://featureadmin.codeplex.com/

Just download it and use it the remove the orphan feature.




SharePoint trouble shooting - Search stopped work due to default trust certificate error

Search doesn't return any result. So checked the ULS log and found out the below error,

Event ID: 8311 An operation failed because the following certificate has validation errors:\n\nSubject Name: CN=SharePoint Security Token Service, OU=SharePoint, O=Microsoft, C=US\nIssuer Name: CN=SharePoint Root Authority, OU=SharePoint, O=Microsoft, C=US\nThumbprint: EB7076586E2CC4A69ED2629497A831D99EB31A1E\n\nErrors:\n\n The root of the certificate chain is not a trusted root authority


Then running the following powershell script to re-issue the certificate and fixed the error.
$rootCert = (Get-SPCertificateAuthority).RootCertificate
New-SPTrustedRootAuthority -Name "localNew" -Certificate $rootCert

 
Restart IIS on all SharePoint servers

Sharepoint trouble shooting - User can not new/edit custom infopath form

There is an error happened when user try to new/edit an list item. This list has been customized using InfoPath form.

So I checked the error log with ULS view and find the critical error below,

The form template failed to load. (.... , Form ID: urn:schemas-microsoft-com:office:infopath:list:-AutoGen-2014-08-20T01:01:56:238Z, Type: COMException, Exception Message: Retrieving the COM class factory for component with CLSID {52F5D46F-CBEA-4D07-BCB7-7296853F0CF2} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).)

This actually because the RichTextBox field is not registered or removed.

So after running the following command to re-register the class, it worked.
regsvr32 "C:\Program Files\Common Files\Microsoft Shared\OFFICE15\htmlchkr.dll"

Wednesday, March 12, 2014

Update a DLL in GAC in a Windows 2012 server

Since .net framework 4.0, the gacutil location has been changed and in a windows sdk folder.
However, on a SharePoint 2013 production box, the windows SDK is not installed.
Here is the Powershell come to rescue.

[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

$publish = New-Object System.EnterpriseServices.Internal.Publish

$publish.GacInstall("...you dll path");



 

Monday, January 6, 2014

Tip to debug localhost with fiddler

If you need to debug the http request/response for the localhost,
you can send to http://ipv4.fiddler/folder instead of Http://localhost/folder
port number also works.

Monday, December 23, 2013

Rebind AngularJS in ajax call

Just a quick tip when I am trying to working on the angular with jquery ajax.

After the data is assigned in an ajax call back function, angular won't be able to monitor change,
in this case, $scope.$apply() will be needed to reflect data binding.

Thursday, December 19, 2013

SharePoint 2013 TypeLoadException Error when set up BDC

If you set up the BDC model and you may get an error in ULS log as below,


The Type name for the Secure Store provider is not valid. ---> System.TypeLoadException: Could not load type 'Secure Store Service' from assembly 'Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. 
InnerException 1: System.TypeLoadException: Could not load type 'Secure Store Service' from assembly 'Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.   


The reason is that in the BDC service application, its external system instance not set up correctly for the property "secure store implementation", when the instance is created it is blank, not like SharePoint 2010 the value is pre-populated, so naturally by the name definition, I put in the secure store service proxy name such as "Secure Store Provider".

This is wrong, what we should put is the type name as below,
Microsoft.Office.SecureStoreService.Server.SecureStoreProvider, Microsoft.Office.SecureStoreService, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c

Then it worked.