SharePoint search is returning 500 internal server error page : Resolved

Recently i was working on a Intranet Portal and most part of it was based on documents collaboration. So to easily find a document i configured search for the site. I created a new content source in existing search service application and crawl the source. It was crawled successfully without showing an error or warning, but when i opened the site in IE i was presented by an 500 internal server error page. I tried one more time and same result, i suspect that there is something fishy in IIS (may be application or app pool is stopped). To my surprise there was nothing like that, i reset the IIS but same result. After checking the log file i found this weird entry.

System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure “Resources.lutron.core.resources” was correctly embedded or linked into assembly “App_GlobalResources.0whxr_of” at compile time, or that all the satellite assemblies required are loadable and fully signed.    at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)     at System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey, CultureInfo culture)     at System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName)     at System.Web.HttpContext.GetGlobalResourceObject(String classKey, String resourceKey, CultureInfo culture)     at Microsoft.SharePoint.Search.SPSatelliteResourceExpressionBuilder.GetResource(String classKey, String resourceKey)     at ASP._layouts_accessdenied_aspx.__BuildControlltAccessDeniedCaption()

After sometime i opened the site in Chrome and search was working fine there same was with Firefox. So i thought that there is problem with browser not with SharePoint server. After digging in to IE settings i came to know that there wasn’t any default language set for my IE (Might be i removed this for some testing purpose.)

Every user has a search preference inside SharePoint site and it can be accessed through below link.

http://My_SharePoint_Site/_layouts/EditUserPref.aspx

In this page, by default search language is set as ‘Search using my browser’s language‘. Other option is ‘Search using the following languages (maximum of five)‘. So if the option 1 (default) is selected then there should be a default language set in your browser otherwise you’ll get 500 internal server error.

In case option 2 is selected, then search is not dependent on browser language preference. In my case i just set the browser default language in place of opt for option 2. Below are the steps.

  1. Tools > Internet Options.
  2. Under General tab, click on languages button.
  3. Inside Language Preference window, add a language (in my case it was English (United States) ). If you add multiple languages in this window then the first one will be treated as the default language for browser.

*You can also opt for option 2 mentioned above as per your choice.

Happy SharePointing 🙂

Update custom list’s feature reference | Update custom list’s feature id reference.

Disclaimer: Approach used in this blog post is risky and not recommended. The idea of this post is to just understand the insight and sharing my experience with my blog readers. If still you want to try this for any situation then please do this at your own risk.

We earlier created a custom list using list definitions feature in our site. After one month, we decided that the list definition responsible for list creation had to move to another feature to make the feature as the group of alike lists.

After deployment, we found that list was not being opened and was throwing error. So after digging in to log file, I came to know that list was still pointing to previous feature and now that feature didn’t have the reference for the list schema (As we had already moved the reference to the new feature). I was not ready to take risk of deleting the existing list as it was already contained thousands of referenced items. Deleting the list means to do lots of manual work to fix the functionality and to waste the time and effort.

Now there was only one way that if somehow I could change the reference of existing feature id of list to new feature id. But how that was possible??

I couldn’t found a direct way by using code or Power Shell script to change the feature reference of existing list. So I started analyzing and thought that at least there must be some place where SharePoint keeps this configuration and my mind said content database. Now as you know that SharePoint content database is not a piece of cake to understand and it’s very complex to understand. Everything is based on GUID and referencing is too complex to understand. Due to this complexity, Microsoft doesn’t recommend to touch the content database. But for me there was no other way. So below is how I fixed this issue.

  •  In site content database, there is a table (AllLists) that has all such references. This table keeps the relation information of a custom list and feature related with the list.
  • tp_Title‘ column has the name of list(s) and ‘tp_FeatureId‘ column keeps the feature id related to the specific list.
  • My list name was ‘AnnouncementCategory’ and first I perform the below command.

SELECT *  FROM [AllLists] where tp_Title like ‘%Announce%’

This query gave me all related lists result set. After analyzing the result set I came to know that all other related lists are pointing to same feature id but the problematic list was pointing to different feature id (The previous feature).

  • Now I decided to update the feature id value to see the difference. I noted down the current feature-id value at notepad (In case to revert back the changes) and execute below mentioned update command to update the feature id.

update AllLists set tp_FeatureId=’xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’ where tp_ID like ‘%xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%’

tp_FeatureId : This is the feature id of new feature that contains the reference of the existing list. You can get this from your code file (Feature.xml) or from 14 hive (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES).

tp_ID : This is the unique id column in the AllLists table to identify a specific record.

  • After running this command, when I tried to open the problematic list then to my surprise it opened without any error. After that I performed some testing on the list to verify that whether everything is working fine or not.
  • Testing included adding/updating/deleting/content migration and lookup references of list.

For me after spending a couple of hours, it was like bingo. Happy Share Pointing 🙂

Microsoft Outlook Search is Not Working : Resolved

I had Outlook 2010 and I was not able to search any email using search box. Whenever I used to click on search box provided in Outlook, Search toolbar area got grayed out. Even if I tried to search email by putting criteria manually, it didn’t work out for me. Search functionality is the backbone of any system where tons of information is stored.

To fix this issue always look for below options one by one.

1. File > Options. Now in right hand section of ‘Outlook Options‘, click on ‘Search‘.

2. Click on ‘Indexing Options…‘ button. Start indexing your email, so that they could show up in search.

What if ‘Indexing Options…’ is grayed out?

  1. Click on Start > Run in your windows. Or you can press ‘window key + R‘ keys combination.
  2. Type ‘Services.msc‘ and hit enter.
  3. Inside Services console, Select ‘Windows Service‘ and check whether it’s stop or not. If it’s stopped then start the service.
  4. If this service is disabled then first enable this service (Right click the service and then click on Properties. Under General tab, change the option to ‘Automatic‘ in Startup type. Click Ok and then start the service.)
  5. Now check the ‘Indexing Options…’ This should worked now.

 Still have issues. More places to look in to fix this issue.

  1. Click on Start > Control Panel.
  2. Open Programs and Features.
  3. Now click on ‘Turn Windows features on or off‘ (Resides in left hand side of window.)
  4. Check whether ‘Windows Search‘ check box is marked. If not then mark it and click Ok.
  5. After completing this, you can follow above steps to run the Windows Search.

Remove orphan feature(s) entry from SharePoint’s ManageFeatures.aspx

At times we need to get rid of feature(s) from SharePoint farm, those are no longer required. This is kind of cleaning and managing your SharePoint Farm. Most of the time due to inappropriate procedure or by using a 3rd party tool, Feature gets removed but it still displays on Feature.aspx page. When you try to search this feature through PowerShell or by tool, this feature becomes unavailable.

The simple reason of this is that it gets degraded and loose its scope and it has an orphaned entry in database.

So below are the steps to resolve this i.e. to clean up the feature reference from ManageFeature.aspx page.

  • First of all open ManageFeature.aspx and copy the title of the feature that needs to be removed from the page. Paste the title in a notepad file (To remove any formatting or extra space while copying the title).
  • Open SharePoint Management Shell as an administrator.
  • Run below commands:

$feature = Get-SPFeature | ? { $_.GetTitle(1033) -eq “Orphaned feature name” }

$feature.Delete()

Happy SharePointing !

PeoplePicker not showing FBA users (Claims Based Authentication)

Recently i faced an issue in a SharePoint site while i was trying to add a FBA user in a site group. On searching the user in people picker, it was not showing the FBA user(s) to select. Every time i searched the FBA user(s) through people picker, it returned me only user(s) from AD. I searched Google but no clear instructions on how to resolve this issue. Finally after some R&D, i was able to resolve this. So i thought to pen it down step by step for you guys. Here are the steps.

First we need to know the values of ‘Membership Provider’ and ‘Role Manager’ of web application.

1. Navigate to Central Administration > Application Management > Manage web applications (Under Web Applications section)
Or
Directly navigate to http://<CA URL>/_admin/WebApplicationList.aspx

2. Select web application (That’s need to be configure for FBA users search.).
3. Click on Authentication Providers from ribbon.
4. Inside Authentication Providers pop up, Click on ‘Default’ hyperlink under zone column.
5. On Edit Authentication Modal popup page, go to Claims Authentication Types.
6. Note down the value of ‘ASP.NET Membership provider name’ and ‘ASP.NET Role manager name’.
7. Exit from the CA.

Make entries in web.config of application.

1. Open web.config file inside ‘C:\inetpub\wwwroot\wss\VirtualDirectories\<Application Folder>’ folder.
2. Search for ‘<PeoplePickerWildcards>’
3. Now add values of ‘Membership Provider’ and ‘Role Manager’ in this section as shown below.
<PeoplePickerWildcards>
<clear />
<add key=”<Your Membership Provider Value Goes Here>” value=”%” />
<add key=”<Your Role Manager Value Goes Here>” value=”%” />
</PeoplePickerWildcards>
4. Save and close the web.config.
5. Now find FBA user through people picker and it will work.

Happy Share Pointing 🙂

Download Files/Images from SharePoint Libraries using PowerShell

I consigned a task to backup all files inside different document libraries of a SharePoint site on hard disk. We need to reorganize the entire site and this site comprises so many document libraries. So downloading documents one by one is a gigantic task as the site has gigs of docs. Alternative option is to open libraries in explorer and start copying them to a place, but this methodology has so many limitations e.g. network speed, installation of office components, much time required etc.
I want to get this job done hastily. So for a moment I thought of Power Shell. I want to give it a try and trust me by using this I was able to download gigs of documents within minute. Below is the code snippet for your reference:

 

######################## Start Variables ########################
######################## Download Files Script######################
$destination = $args[0]
$webUrl = $args[1]

##############################################################
# Replace actual document libraries name with DocLib1, 2, 3 etc.
$listUrls=”DocLib1″,”DocLib2″,”DocLib3″,”DocLib4″,”DocLib5″

$web = Get-SPWeb -Identity $webUrl

foreach($listUrl in $listUrls)
{
$list = $web.GetList($webUrl+”/”+$listUrl)

function ProcessFolder {
    param($folderUrl)
    $folder = $web.GetFolder($folderUrl)
    foreach ($file in $folder.Files) {
        #Ensure destination directory
        $destinationfolder = $destination + “/” + $folder.Url
        if (!(Test-Path -path $destinationfolder))
        {
            $dest = New-Item $destinationfolder -type directory
        }
        #Download file
        $binary = $file.OpenBinary()
        $stream = New-Object System.IO.FileStream($destinationfolder + “/” + $file.Name), Create
        $writer = New-Object System.IO.BinaryWriter($stream)
        $writer.write($binary)
        $writer.Close()
        }
}

#Download root files
ProcessFolder($list.RootFolder.Url)
#Download files in folders
foreach ($folder in $list.Folders) {
    ProcessFolder($folder.Url)
}}

 

Copy this to a notepad file and save with extension .ps1 E.g. DownloadFiles.ps1

Open SharePoint Management Shell 2010; navigate to the path of script. Provide destination path as argument 1 and site URL as argument 2 as shown below.  

.\DownloadFiles.ps1 “d:\documents” http://mySite

*This will create separate folders for each document library with library name.

 

Failed to open the default internet browser SharePoint : Resolved

Recently i uninstalled Chrome browser from my machine. After that when i tried to open Central Administration then below mentioned

error popped up as message.
Failed to open the default internet browser. An Internet browser is not  installed or has not been configured to be your default browser
I checked the target of Central Administration and found it was correct i.e. “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\psconfigui.exe” -cmd showcentraladmin”

So issue was that Central Administration application was unable to detect default browser. Though i have 2 different browsers on my machine including IE 9.

Below are the steps to fix the issue. Though these steps are specific to Windows 7 but you can use them with any Windows OS.

  1. Go to Control Panel.
  2. Click on “Default Programs“.
  3. Click on “Set your default programs“.
  4. Click “Internet Explorer” under Programs section (Left hand side in Windows 7) and click on “Set this program as default“.

You are done. Happy SharePointing 🙂

Deleting EXE Files in Windows 7 : Resolved

If you are working with Windows 7, you must face below mentioned problems while deleting .exe files.

  1. Like if you delete an exe file directly then it disappears and seems like deleted, but when you refresh the folder by pressing F5 then it appears again.
  2. You are deleting a folder and that folder is not getting delete as there is an exe file inside that folder.

Initially I thought of that there is a virus in the system but after scanning the whole system 2-3 times with different antivirus program, I found that there is no such virus in the system. So what’s the root cause of this problem?

I thought that, might be these exe are running somewhere but after checking task manager I couldn’t found anything specific. So I conclude that here must be some service that is locking the application and service is not necessarily using these exe but just holding them. So I opened service console to examine same. After checking Services console I found that there is a service ‘Application Experience‘ that is responsible to process application compatibility cache requests for applications as they are launched was DISABLED. I simply enabled this service and start the service. And now I can delete exe files and folders smoothly.

Till now i tested this only on Windows 7 OS but it should work on VISTA and related windows os.

Cheers !

Edit More Than 200 Rows in SQL Server 2008

While working with Sql Server, sometimes we need to update a record quickly. Even so quickly that we don’t want to write a query. Even that’s not a big problem just we need to right click desired table and select “Edit Top 200 Rows” option. This opens top 200
records of that table in editable mode and you need to just make desired changes inside cell of specific record and press tab. Its quite quick but what if that our records doesn’t come in top 200 and its placed after 200 in table e.g. 500th position. Ohhh for this i cann’t be lazy and have to write update query 😦
But before doing this wait for minute as even we can edit more than 200 records using editable window. But how ??? Below is the solution :

In Sql Server 2008

  1. Click on Tools > Options…
  2. Inside Options window, Select “SQL Server Object Explorer” in left pane.
  3. On Right side pane under “Table and View Options” section, change value of “Value for Edit Top<n> Rows command” property from 200 to something higher e.g. 1000.
  4. Click on Ok and you are done.

Now whenever you right click on any database table you will find option “Edit Top 1000 Rows“. Just click on that and an editable window with top 1000 records will open in fronts of you.

So be lazy after doing this smart workaround. 🙂