Search This Blog

Tuesday, June 14, 2011

To know if the variation exists (programmatically)

Sometimes we need to perform some action if the variations are present on that web. So, to identify this programmatically we need to find the count of the “Variation LabelsLists ,
Code Sample:
using (SPSite objSite = new SPSite("URL"))
{
using (SPWeb objWeb = objSite.OpenWeb())
{
SPList objList = objSite.RootWeb.Lists.TryGetList("Variation labels");
if (objList != null)
{
if (objList.ItemCount > 0)
{
//Variation Present
}
}
}
}

No comments:

Post a Comment