Monday, November 8, 2010

"BDC Metadata Store is currently unavailable" when I try to get the External Content Types on SPD

This issue I faced when I was trying to make one POC using BCS for SharePoint 2010.

First I found that my SP was trial so I upgraded it to "SharePoint Server with Enterprise Client Access License".

I was giving me same error even after upgrading then i saw on other vpc with same config and licence where it was working.

There I found the solution, which is that we need to do association of BDC service with the desired web application.

Goto : Central Admin -> Application Mgt -> Manage Web Application -> Select desired Web Application -> click 'Service Connections' from ribbon buttons -> in the popup make sure "Business Data Connectivity Service" is checked.

And bingo it worked..

Wednesday, October 20, 2010

Populate list items automatically when list definition feature gets activated

SharePoint 2010 - There was a requirement in which I had to populate 2 list items when its list definition feature gets activated.

Following is the solution:

Into Elements.xml file of list instance


< ?xml version="1.0" encoding="utf-8"?>

< Elements xmlns="http://schemas.microsoft.com/sharepoint/">

< ListInstance Title=....... ;">



< Data>

< Rows>

< Row>

< Field Name="Title">.....</Field>

< Field Name="MailBody">.....</Field>

< /Row>

< Row>

< Field Name="Title">.....</Field>

< Field Name="MailBody"></Field>

< /Row>

< /Rows>

< /Data>



< /ListInstance>

< /Elements>

Happy SharePointing.... :)

Validate CheckboxList Control with javascript to make sure atleast one checkbox is checked

While developing one page which sends mail to the selected group from the checkbox list I got requirement to impose validation to check atleast one group should be selected.

Here is the solution.....

< id="CvalGroupCheckbox" display="Dynamic" runat="server" cssclass="MsgLabel" errormessage="" clientvalidationfunction="validateGroupSelection">

< language="javascript" type="text/javascript">

function validateGroupSelection(source, arguments) {
document.getElementById("").style.visibility = "hidden";
var chkSubUsers = document.getElementById('_0');
var chkTestUsers = document.getElementById('_1');

if ((!chkSubUsers.checked) && (!chkTestUsers.checked))
arguments.IsValid = false;
else
arguments.IsValid = true;
}

< /script>

Happy programming.... :)

Monday, August 30, 2010

Query to SharePoint database and WSS_Logging Database

While googling for my What's Hot web part I found 2 very good articles which explains why we should not query sharepoint db. And how we can use WSS_Logging db


Cheers

Monday, August 23, 2010

Monitoring SharePoint Usage through an ASP.NET Web Application

Monitoring SharePoint Usage through an ASP.NET Web Application
By Gayan Peiris

This is very good article for creating an application which can show a desired site usage details


Thursday, August 19, 2010

How to get a month name from date

We can get the month name using following statement

CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(datValue.Month)

Cheers..

How to get all available page layouts which can be used to create and page

There was a task in which i had to check what all page layouts are available for a current site which can be used to create a new page. So here is the solution

PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web);

PageLayout[] pageLayouts = pubWeb.GetAvailablePageLayouts();

PageLayout pageLayout = pageLayouts.Where(p => p.Title.Trim() == item["LayoutName"].ToString().Trim()).FirstOrDefault();

if (pageLayout == null)
.......

Cheers....