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 !

Advertisements

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 🙂

Installing assembly in GAC in Windows Server 2008 : Resolved

I developed an event handler and need to deploy it on production server. My production server is built on Windows 2008 Enterprise Server 64 Bit and there was only one installation on server i.e. SharePoint Server 2010. Now I need to install my assembly in to GAC. I copied my .dll to production server. Then I opened c:\windows\assembly and drag drops my assembly in to GAC (c:\windows\assembly folder). But nothing happened and my assembly couldn’t install in GAC 😦

Drag and drop was not working. So second alternative was to use gautil.exe to install the assembly inside GAC but as it was production server so there wasn’t any installation of visual studio and hence there was no SDK installed therefore there wasn’t such exe like gacutil.exe. Again that was a problem. Now I worked on why drag and drop is not working. I searched here and there and follow some articles but nothing helped me. I disable UAC and restart server but it doesn’t work. I opened console and explorer using run as administrator but nothing helped me. Then I copied gacutil.exe file from my development machine to production server but I couldn’t run it (Though lastly this technique worked for me).So finally I resolved this issue and below are the directions for how to resolve this?

1. First check that if production server is of 32 bit or 64 bit?

2. If it is 64 bit then open folder “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64

But if it is 32 bit then open folder “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

3. Copy 2 files i.e. gacutil.exe & gacutil.exe.config

4. Paste these files to any location of production server.

5. Your gacutil.exe is now ready to run and u can install assembly in to GAC using this small utility.

 Points to Remember

* When you drag and drop assembly in GAC it won’t give proper error messages (Like targeting framework error) if it has any so better to use gacutil to install assembly.

* gacutil.exe doesn’t run standalone rather it needs a configuration file to run i.e. gacutil.exe.config

Command Line Error by STSADM : Resolved

I was executing a command using stsadm and when I hit enter it was displaying an error stating that “Command Line Error”. Everything was perfect from my end but it was weird to getting this error. So finally I could resolve this. For information how to resolve this find my earlier blog post here.

Though it was for a different problem but resolution of both problems is same.

Enjoy SharePointing……….

Resolved: The given assembly or codebase was invalid error by stsadm command

I was trying to register custom profiledeletehandler by using stsadm command line utility. My command, code and assembly were perfect. But even then when I was trying to execute stsadm then it was displaying “The given assembly or codebase was invalid”.

Humnnn what could be the problem then after doing some research I came to know that I wrote the part of the command in notepad first and then copy/paste this part in command line. OMG, that was some encoding problem while copy/pasting the command.

Though if you delete the stsadm command and retype this in command line console then both (earlier & retyped) will look same. But this was only and major difference and solve the problem.

Solution: Please type the whole command by your own including each and everything.

Moral of the Story:

1. Avoid copy/pasting the stsadm command from other application as you can be the victim of this type of problem.

2. Always do check for PublicKeyToken values (If u are using assembly reference) twice and other spelling mistakes in stsadm command, as it can be the cause of these type of problems.

Create Hierarchies Link in SharePoint Variation Site is not working : Resolved

Problem: Inside variation labels, if we click on create hierarchies button nothing happens.

Scenario: I had a publishing site with variation enabled on a specific port. I backed up the site and restore it on a web site hosted on another server. This new website is on different port. Now i created a new variation label inside new site and after creating variation label, when i clicked on Create Hierarchies button nothing got happen. So i started to search the root cause of this problem. I first open the variation link to check the variation settings and here i found that location in the variation home section was pointed to the old server and settings were disabled. Humnnn it meant that this was the root cause of the problem. So question arises that how to change the settings as i wanted to keep all the sites that were earlier created by using variation hierarchies and using GUI there was no option to reset these settings. After searching Google, i couldn’t find any specific things regarding this. Problem was that linking in variation settings was not appropriate. So after spending lots of hours to fix this problem i came to know that there is a hidden relationship list inside the publishing site that has variation functionality. So after tweaking my site URL i got that list. Below are the steps to fix this problem.

1. Append your root site URL like this “http://testserver:9001/relationships%20list/allitems.aspx“.

2. Relationships List will open and here you will see so many entries of (no title) depending upon the earlier sites created.

3. You have to open and view each item until you find the value “F68A02C8-2DCC-4894-B67D-BBAED5A066F9” against the GroupId column.

4. This item has relation link for variation home site and this value will same for all publishing sites having variations.

5. Edit the item.

6. Against ObjectId column fill the URL of root site e.g. http://testserver:9001

7. Give any title and click on OK button.

8. Come out from that list, create a new variation label and then create hierarchies button.

9. Voilà hierarchies are creating now.

 

Exports excel data to SharePoint custom list with desired column names!

So once again I am back with a blog post…

Today we will see that how to import a spreadsheet inside a custom list with defined columns.

We are ready for production deployment for an application. This application contains the master data for cities all over the world. Client provided us the list of 9000 cities that need to be inserted inside master custom list as we know that 9000 entries will take the hell lot of time to add in the list. So how would I do it within the sort span of time?

The only way that I put all the cities inside an excel and then create a new a custom list by importing that excel. So I start the thing. I create a list using import spreadsheet option but ooopsssss all cities updated inside that custom list but when I look at the column name this shows me like Column1, Column2, etc….

This was very disappointing as this list and columns are used in my custom code, and I don’t want to change my code due to this.

SO QUESTION WAS that I want 9000 entries inside custom list with desired column names…

What to do so below are the steps to do that.

 

  • First open the excel sheet.
  • Paste the data inside excel sheet accordingly you want.
  • Now in the first row put the column name that you want the list column name.
  • Remember that between two columns there should not be any column left blank.
  • Now select first cell of the sheet.
  • Click on Insert tab and then click on the table.
  • It will open a Create table window with the selected range of data.
  • Select my table has headers checkbox then ok.
  • Now your sheet is in a table format, and we are on the way.
  • Now open the site and select on create.
  • Create the custom list using import spreadsheet option
  • Give a name of the list and path of the excel sheet and click on import.
  • It will open the excel sheet and a window.
  • Select cell ranges in the drop down and give the range of the cells.
  • Just import and after completing the process we have a custom list with data and desired column names.

Happy SharePointing 🙂

Resolved: Could not load file or assembly ‘Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies…

I have a solution that contains SharePoint dll’s reference. Whenever I run the solution, start page get crash and show me this error.

“Could not load file or assembly ‘Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”

Well every time I run the project it creates Microsoft.SharePoint.Search.dll and Microsoft.SharePoint.Search.xml inside the bin folder and it creates the problem. Well there are lots many things have written on web regarding this problem. I follow all these things but could not get rid of this error. Finally I decided to fix this problem according to my way. So below are the steps to fix this problem permanently.

1.       Inside solution explorer (Visual Studio), select the project and right click on that.

2.       From context menu, click on properties.

3.       When properties page opens, Click on Build Events.

4.       Under Post – build event command line, copy and  paste below lines

cd $(TargetDir)

del Microsoft.SharePoint.Search.dll

del Microsoft.SharePoint.Search.xml

Now save the project, build the project and run. Now above mentioned error will never irritate you. 🙂

Resolved: The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.

During my SharePoint project i need to clean up the site for better performance.  So first thing i started to delete the closed web parts from web part pages. As there were so many web part pages in the application so i decide to write a web application that can delete the closed web parts after run. Well when i run the application i got “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.” error  on delete operations. I knew that this error was due to the fact that Web Page Security Validation was turned on that site and it was restricting me to delete the web part from my application. I can change the settings from Central Administration by turning off the security validation for that site but it’s not a good practices as any malicious code can harm your site as the security validation was off for that site. So i decide to handle this thing pro grammatically from my code so that it only disable security validation of web for a moment when only my code will run otherwise it will be on and protect my web from harmful activities. Well so here is the solution i applied.

Microsoft.SharePoint.Administration.SPWebApplication webApp = web.Site.WebApplication;
webApp.FormDigestSettings.Enabled = false;

// Insert your code for adding/deleting/updating here

webApp.FormDigestSettings.Enabled = true;

That’s it and i was back for deleting closed web parts 🙂

How to remove/delete SharePoint extended site placed in different zones

Well as we know that we can extend a SharePoint site for different zone other than default with different port number and host header. In extended site creation, a new site creates on IIS pointing to a new virtual directory on server. This new virtual directory has its own web.config file for extended site. But extended site points to same content db as the original site has. Therefore end user access same contents through different site urls depending upon the permission set on individual sites. In short you can say that extended site is a replica of its original site as both sites serve from same content db.

Now you want to remove/delete an extended web site from SharePoint server. What to do as extended site doesn’t show in “web application list” and in “Delete Web application”. Well no probes as I mentioned earlier that when we extend a web application it just create a site in IIS and point to existing site content database. So if we remove it from IIS and delete the virtual directory created by extended site then it should remove and delete from SharePoint server. But that’s a manually part and in this case we can miss some references. So here is the best practice for that:

  • Open Central Administration and go to Application Management tab.
  • Under “SharePoint Web Application Management” section, click on “Remove SharePoint from IIS Web site” link.
  • Select the actual web application from which you create extended site.
  • Under “Select IIS Web site and zone to remove” drop down list, expand the drop down by clicking the arrow button.
  • Here you will get all the extended sites with their zones including the actual website (Always created in Default Zone).
  • Select the extended site that you want to remove.
  • Under “Delete IIS Web sites”, check the Yes radio button and click OK.
  • Wait for processing and after completing the process you are done.