Showing posts with label sharepoint. Show all posts
Showing posts with label sharepoint. Show all posts

Friday, July 16, 2010

Could not access the Search administration database. A generic error occurred while trying to access the database to obtain the schema version info.

While installing SP2010 on Windows7 for development, you might face this error "Could not access the Search administration database"

Exception: System.Runtime.InteropServices.COMException (0xC0041236): Could not access the Search administration database. A generic error occurred while trying to access the database to obtain the schema version info.  



Resolution:


Check your SQL Server Client10.0 configuration settings, by going to Start Menu -> SQL Server 2008 R2 -> Configuration Tools -> SQL Server Configuration Manager.


And check whether Share Memory option is enabled under "Client Protocols". It should be enabled.






Run again the SharePoint 2010 Products Configuration Wizard




Happy Programming!!!!


Friday, July 02, 2010

Deploying sharepoint solution - IIS Restart issue

IIS Restart Issue "Access denied"


Quite often the developer will face a below issue while deploying the (WSP) solution in VS2010 running on Windows 2008. Especially if you have not logged in as administrator.


'Recycle IIS Application Pool': 0x80070005Access denied"


The root cause of the issue is

  1. You don't have IIS restart privilege on window2008 
  2. Even if you have it, you have not added your login account in to SharePoint sitecollection administrator.
To solve the issue
To see whether you have privilege or not, you can open a command prompt and type "IISReset". 
If you able to restart, then it will restart successfully otherwise it will deny it.  The reason is, Though you are in administrators group, windows 2008 will not run on the administrator privilege. Every time when you do an operation like IIS restart or Installation, it will prompt for UAC (User Account Control). You should accept the dialog box and elevate the privilege to run the operation. 

Or you can right click the application whatever you want to run and click the menu option "Run as Administrator" which will solve the issue.
If you want to avoid UAC and directly run through you admin account then, go to Control panel -> Manage account -> Hide UAC


Second if you have all the privilege and still you are getting error in VS2010 as "'Recycle IIS Application Pool': 0x80070005Access denied", then you have to add your account in to site collection admin.
1) You can do this by going to sharepoint administration page.
2) Navigate to the site collection administration option
3) Add your name into site collection administrator as a second owner. SharePoint will allow a second owner for site colleciton

After adding it , now you can deploy the solution through VS 2010.


Happy coding.



Wednesday, February 18, 2009

Hiding webpart in SharePoint webpart gallery

How to hide webpart in Sharepoint Webpart gallery


To hide the webpart in webpart gallery programmatically, you have to write a feature class which drives from SPFeatureReceiver. This Feature receiver class will be called during feature activation/deactivation.


Steps
----
1) Get the instace of SPweb
2) Get the list from parent as "Web Part Gallery"
3) Find webpart ID
4) Delete from List
5) Update the list


Sample code snippet


public void OnActivated(SPFeatureReceiverProperties properties)
{
SPWeb web = (SPWeb)properties.Feature.Parent;
SPList list = web.Lists["Web Part Gallery"];
int itemID = 0;
bool flag = false;
foreach (SPListItem item in list.Items)
{
if (item.Name.ToLower() == "test.webpart")
{
itemID = item.ID;
flag = true;
break;
}
}


if (flag)
{
list.Items.DeleteItemById(itemID);
list.Update();
}
}


Enjoy programming