Saturday, September 24, 2011

Fixing issue "Access denied by Business Data Connectivity"

While working with BCS I have encountered an issue "Access denied by Business Data Connectivity"
Here, I was creating one external content type with a connection to a SQL server database. Please follow this blog to create such list.
After creating a SharePoint list, when I am trying to open it on the browser, following error is generated. 

 To Fix this issue, on the Central Administration, modify service application and grant permission to the BCS data connections. Please follow these steps: 




Now, the correct result is showing like this:

Wednesday, August 24, 2011

Delegate control in SharePoint

SharePoint offers a fine way to override it's built-in functionality. With the help of delegate control you do not required to modify the existing master page to modify existing features.

First, create a empty SharePoint project, and specify the target web url. Next select 'Farm Solution' a deployment option. Now add one User Control in the SharePoint mapped folder 'Control Templates'. Add functionality to this user control based on the requirements.
Now, create one element file, and add the following xml.
< ?xml version="1.0" encoding="utf-8"? >
< Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
  < Control Id="GlobalNavigation"
           Sequence="10"
           ControlSrc="~/_ControlTemplates/SampleTestNavigation/TestNavigation.ascx"/ >
< /Elements >


Here, GlobalNavigation control defined in the master page will be overridden by this custom control. The Sequence value should be less than 100. 


Deploy the solution. And the output will be look like this:

Sunday, August 21, 2011

Creating UDC in InfoPath forms

During development there is common requirement is to create InfoPath forms, those can be deployed into multiple servers. Once you completed the development in local DEV, the forms need to deploy in Stage and Prod. Here an issue arises, the connection. Since the path of different servers are different one need to create 'Universal Data Connection' (UDC) 


1) Create a connection for submit data, and follow the wizard

2) Create a Connection Library, then click on the 'Convert' button, this will generate one XML file. Specify a name of the connection with extension UDCX

3) After creating the UDCX file, on the InfoPath form, add a new connection and browse all the connections on the server.

4) Important, for each server, Staging, Prod etc you have to create data connection file with the same name. In this example submit.udcx. The forms will pick dynamically the connection based the respective servers.




Friday, July 15, 2011

Sharepoint 2010 Timer Service error code 1069

On my local SharePoint server, Timer Service gives me an error "The service could not be started due to logon failure".


Initially I thought that, there is a need to enable some service from the Central Administration. Later realized that the issue is in the service itself.
The issue is fixed after setting of proper password within the service properties.


Thursday, July 7, 2011

Fixing error "Cannot generate serialization assembly"

Recently on my development machine I faced this error in Visual Studio. The error occurred at the build a project, and that project is already in use on the local machine.
Now, the problem here is, out the error message nothing clearly come out. After further research I found that the output dll is already present in GAC and after removing that dll, the project showed successful build.


Cheers!!
Somu

Friday, June 24, 2011

Shrink Database

While working with MOSS and Project Server I noticed the physical hard disk size is growing rapidly and captured a lot of space. After opening the database files I found the DB log file taking huge space. 
 (Before)


Following Database script is executed on SQL Server to Shrink the size of the log files. It is very effective to reduce the size.
USE XXX_MOSS_Config
GO
ALTER DATABASE XXX_MOSS_Config SET RECOVERY SIMPLE
DBCC SHRINKFILE(N'XXX_MOSS_Config_log', 1)
ALTER DATABASE XXX_MOSS_Config SET RECOVERY FULL
GO

 (After)
Cheers!!!

Creating Custom Application Pages in MOSS

On a development cycle, you might need to create several custom Application Pages, which will be stored in Layouts\FolderName\YourPage.aspx.


While creating the page the base class need to inherit is "LayoutsPageBase"
Here is a blog specified about the steps for creating the pages.


Now, the challenge is, when you create such Application page for Anonymous Access, the user  asked for a log in. Means the Anonymous user redirected to the login page. 


To avoid such scenario, there is another base class need to inherit "UnsecuredLayoutsPageBase"
The code of the page will look like this:

protected partial class CustomPage : UnsecuredLayoutsPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}
On the same page, following method also need to be added for smooth functioning:
protected override bool AllowAnonymousAccess
{
   get
   {
       return true;
   }
}
Cheers!!
Somu