Thursday, May 19, 2011

Cascading lookup field in SharePoint 2007 / 2010

Check out this articles. They provide a nice and easy way to create cascading drop down lookup fields in your new or edit form.

SharePoint 2010: How to create Cascading Lookup Field (InfoPath approach)
http://blog.libinuko.com/2010/07/21/sharepoint-2010-how-to-create-cascading-lookup-field/

SharePoint 2010: How to create Cascading Lookup Field using Client Object Model
http://blog.libinuko.com/2011/01/29/sharepoint-2010-how-to-create-cascading-lookup-field-using-client-object-model/

There is also a ready to use solution available on codeplex which uses a different approach of using custom field controls for achieving the cascading effect.
http://cascddlistwithfilter.codeplex.com/

Reference:
http://datacogs.com/datablogs/archive/2007/08/26/641.aspx

Wednesday, March 9, 2011

Increase Rich Text Editor’s Field Width in SharePoint site


There are times when you would like that the rich text editor on your SharePoint site fits the entire page width so that you can edit the content easily. By default, the editor field is around 400 pixels in width and does not increase beyond it. It is due to the CSS style applied on that SharePoint field control.

I wanted something like this on my site:


This is how you achieve it:
https://zsharepoint.wordpress.com/2013/05/15/sharepoint-101-full-width-rich-text-editor/

Thanks to Zach. This was a very simple CSS hack to modify the width of the rich text editor.

1. Create a new .css file and enter the following code over there:

#onetIDListForm, #onetIDListForm .ms-formbody, #onetIDListForm 
iframe[title="Rich Text Editor"]{width:100% !important;} 
.ms-formbody span span div iframe, .ms-formbody span span 
table.ms-long{width:100%; text-align:left;} 

2. Save the .css file in a document library on your site.
3. Reference the .css file in the masterpage using the following code.

NOTE: There is some problem with blogger, not allowing me to post the entire code. Please refer to the link mentioned above for the code to reference your CSS file in your masterpage. 4. Save the changes to MasterPage and refresh the page.

Or you can check out my another blog - http://sharepointservices.wordpress.com/2011/03/09/increase-rich-text-editors-field-width-in-sharepoint-site

Tuesday, March 1, 2011

An error occurred during the compilation of the requested file, or one of its dependencies.

Issue:
You have done a standalone installation of SharePoint 2010 on a Windows 7 machine. This machine will be mostly used as a development machine. No error messages are received during the set up or while running the configuration wizard. In Central Administration website, when you click on links like "Services on server, Manage service applications, or when you try to navigate to the Web Application's general settings, etc, you get the following error.

The error comes intermittently, but, mostly on the links mentioned above.

Error:
An error occurred during the compilation of the requested file, or one of its dependencies.

Following error is logged in the ULS logs:
Error from ULS Logs of the server:

System.Web.HttpCompileException: External component has thrown an exception. at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert...

Cause:
Compatibility issue between SharePoint 2010 and Windows 7.

Resolution:
Restart the machine where you have installed SharePoint 2010.
Just a restart of the machine should usually resolve the issue for you. In case, the issue rises again after few days, you need to restart the machine. Also, we should not that SharePoint 2010 on Windows 7 is not supported, so we have to live with this work-around for now.

Update (20-September-2011)
If you have a standalone installation on Windows 7 machine, delete the "User Profile Synchronization" service applications from your farm and do an "iisreset". This should take care of the problem and a reboot may not be required everytime.

Wednesday, February 23, 2011

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


Scenario:
You are trying to do a standalone installation of SharePoint 2010 Server or SharePoint Foundation and the Configuration Wizard fails at Step 5. This error occurs during provisioning of the SharePoint Foundation Search Service. All other services are installed properly.

Error:
A generic error occurred while trying to access the database to obtain the schema version info.

If you check the PSDiagnostic logs under C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Logs

You get the following error recorded in that file:

ERR Failed to register SharePoint services.
An exception of type System.Runtime.InteropServices.COMException was thrown. Additional exception information: Could not access the Search administration database. A generic error occurred while trying to access the database to obtain the schema version info. 
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.
at Microsoft.SharePoint.Search.Administration.MSSITLB.IGatherApplications2.Mount(String bstrName) 
at  Microsoft.SharePoint.Search.Administration.GathererApplication.ProvisionGathererApplication() 
at Microsoft.SharePoint.Search.Administration.GathererApplication.Provision() 
at Microsoft.SharePoint.Search.Administration.SPSearchServiceInstance.Synchronize(Boolean installGathererApplication, Boolean startIncrementalCrawl, Boolean startFullCrawl)
at Microsoft.SharePoint.Search.Administration.SPSearchServiceInstance.Provision()
at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.InstallServiceInstanceInConfigDB(Boolean provisionTheServiceInstanceToo, String serviceInstanceRegistryKeyName, Object sharepointServiceObject)
at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.InstallServiceInstances(Boolean provisionTheServiceInstancesToo, String serviceRegistryKeyName, Object sharepointServiceObject)
at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.InstallServices(Boolean provisionTheServicesToo)
at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.Run()
at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()


Possibilities why this issue might arise:
  • Previous installation might have failed to complete successfully due to insufficient permissions or network error. Now you are again trying to run the Configuration Wizard after making some permissions changes.
  • You successfully completed the Configuration Wizard during your previous attempt, but due to some password change or permission changes, the wizard fails this time.
  • There was a network (firewall error) during the configuration tasks.
Cause:
  • Corrupt registry key or incorrect reference to the registry key in the configuration database.
  • Missing protocols for connectivity between SharePoint and SQL (port 1433 should be open or if you are using a custom port ensure that it is open for incoming connections in firewall).
Resolution:
It is a 4 set procedure. I did not want to repeat anything that was already online. So, please refer to the attached links for detailed information on how to carry out the steps.
  1. Ensure that TCP\IP and Named Protocols are enabled for the local SharePoint instance.
    Reference to carry out Step 1:
    http://sureshsundar21.blogspot.com/2010/07/could-not-access-search-administration.html
  2. Delete the registry key at “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\WSS\Services\Microsoft.SharePoint.Search.Administration.SPSearchService”
    Reference to carry out Step 2:
    http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/916e3940-a46a-40d0-9d84-3382f80e987c
  3. Clear the SharePoint Configuration Cache files and restart the timer.
    Reference to carry out Step 3:
    http://blogs.msdn.com/b/josrod/archive/2007/12/12/clear-the-sharepoint-configuration-cache-for-timer-job-and-psconfig-errors.aspx
  4. Ensure the port number 1433 is open (on the server where you are hosting the SQL databases). If you are using a custom port, please enable the port number for incoming connections in the firewall.
    Reference for Step 4:
    http://technet.microsoft.com/en-us/library/ff607733.aspx
Hope this helps. In case the issue is still there, the problem might be related to permissions or firewall. Let me know. Thank you.

Friday, June 4, 2010

"Value does not fall within the expected range" when adding a calculated column to the library/list.


Symptoms:
You create a document library or a list.
Go to site settings and add a calculated column (named CAL1, or any other name) and then save it. This works fine as this is the first calculated column.
You add another calculated column which calculated the value based on the value from CAL1 (from previous step).
In such a scenario, we get an error "Value does not fall within the expected range". But at the same time, the column gets added to the site and functions as expected.

Error(s):
"Value does not fall within the expected range"

Cause:
By-Design.

If you're trying to use it with a Calculated column, then you're trying to force a value into a column for which SharePoint itself is calculating the value.

i.e. CAL2 value is being calculated from CAL1 value which itself is unknown. Anything that is unknown, .NET will treat it as something out of range. Thus, we are getting the error.

Resolution:
With the above explanation, we do not have a resolution for the issue.
SharePoint should ideally show a warning message stating that we are calculating the value based on a column whose value is unknown. Instead of a friendly error message, we are getting a technical error from .NET/SharePoint which causes confusion that something is failing.

You might find these articles useful