How to change language of an existing SharePoint site collection

Hi All,
Recently I had problem with SharePoint site. The problem was that the site was created in “English” and I want to change the language from ‘English’ to ‘Dutch’. Once site Collection has been created with any language, I was not able to change the language with existing site collection.
After doing some research I found solution.

Resolution:
The language of the site is stored at SP Web level. It is stored in database in Webs table. So you need to change the language in database whatever language you want. To change the language in database you need to fire following Query:

For changing the language of all sites in to ‘Dutch’ language:
UPDATE dbo.Webs SET Language = 1043

Changing the language of one site collection: (Dutch language)
UPDATE dbo.Webs SET Language = 1043 WHERE SiteId = [[SiteCollectionId]]

Changing the language of a single web or subsite: (Dutch language)
UPDATE dbo.Webs SET Language = 1043 WHERE Id = [[WebId]]

Note:
Before applying the new language, you need to verify that the language pack for the language that you want to apply is installed on your machine or not. If language pack is not installed then follows the below steps:

1. Go to link:
http://www.microsoft.com/downloads/details.aspx?FamilyID=2447426b-8689-4768-bff0-cbb511599a45&displaylang=en
2. Change the language for what you want to install the pack. Click on Download.
3. SharePoint Products and Technologies Configuration Wizard will open after installing language pack. On the completing the SharePoint Products and Technologies Configuration Wizard, click Next.
4. On the Configuration Successful page, click Finish.
5. The new language’s folder is available at ‘C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\template’. (I.e. for English it would be ‘1033’, for Dutch it would be ‘1043’).


After installing language pack, you can apply different language with SharePoint site.

Hopefully it will helpful to you.

Configure MySite in SharePoint

Hi Guys,

Firstly I would like to appreciate to Chirs Johnson's Blog, which is helpful to me.

I have one portal application developed in SharePoint, but when I clicked on "MySite" link available at top left corner of the site, it’s give me Error:
"The Page cannot displayed"
I come to know that "MySite" was not properly configure with SSP. i did some search and got article from "Chirs Johnson", I just go through his article and it's work for me.
You can get article here:

http://blogs.msdn.com/cjohnson/archive/2006/09/15/754902.aspx

Hope it will helpful to you.

Thanks,

Adding Paging in SPGridview

Hi Guys,

Many times we need to create custom SpGridview control and need to add paging in such control,Here I have gone through bit of code which facilitate to add paging in SPGridview Control.

SPGridView gv = new SPGridView();
gv.AutoGenerateColumns = false;
gv.AllowPaging = true;
gv.PageSize = 10;
gv.PageIndexChanging += new GridViewPageEventHandler(gv_PageIndexChanging);

gv.PagerTemplate = null; //You must add this line before binding the DataSource.
gv.DataSource = dv;//Here dv is an object of Dataview
gv.DataBind();

Now you need to add PageIndexChanging Event.

void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gv.PageIndex = e.NewPageIndex;
gv.DataBind();
}

Hope it will help you.

Error : Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack

Hello All

I have created list in my SharePoint Site. And my requirement is to get data from SharePoint Site.

Here is my Simple code:

using (SPSite site = new SPSite(siteurl))
{
using (SPWeb web = site.OpenWeb())
{
SPList lstUsers = web.Lists["SiteUsers"];
SPQuery Qry = new SPQuery();
Qry.Query = "<Where><Eq><FieldRef Name='IsActive' /><Value Type='Boolean'>0</Value></Eq></Where>";
DataTable dtUsers = lstUsers.GetItems(Qry).GetDataTable();
if (dtUsers != null && dtUsers.Rows.Count > 0)
{
//Bind the data
}
}
}
}


When I am trying to get data from the SharePoint List, I got this Error Message:

Error : ‘Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack’

After doing some research I found solution. I need to change the Authentication mode in configuration file from ‘Form’ to ‘Windows’.

Solution : <authentication mode="Forms"> replace with <authentication mode="Windows">

That’s it, Problem Solved.
It works fine for me, Hope it helps

Forms Authentication in SharePoint

Hello All,


Here is the good article which explain how to extend FBA site from Window Authenticate site and How to configure Forms Authentication in SharePoint Site.

This article provides detailed description of how to configure Forms Authentication with SharePoint site with code.

Thanks.

Creating Custom Site Definition in WSS / MOSS

Site Definition: It is foundation on which all sites and templates are built. Inside each site definition sub directory the aspx pages for the various WebPages and lists that make up site definition are stored.

The Site Definition folder is located at ‘C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates’ on the SharePoint Server.
Each Site Definition has its own sub directory under this folder.

Steps to Create Custom Site Definition:

1. Navigate to ‘C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates’

2. Copy the STS directory and paste it to back in same directory, Rename the Copy STS directory to DEMOTEST.

3. Navigate to ‘C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033’

4. Follow the same procedures as you follow in step -2 and step-3 for STS directory.

5. Navigate to ‘C:\Program Files\Common Files\Microsoft Shared\web server
extensions\12\TEMPLATE\1033\XML’

6. Copy the WEBTEMP.XML file and paste it in to same directory and rename it ‘DEMOTESTWEBTEMP.XML’.

7. Put the following lines into the DEMOTESTWEBTEMP.XML

<?xml version="1.0" encoding="utf-8" ?>
<!-- _lcid="1033" _version="12.0.4017" _dal="1" -->
<!-- _LocalBinding -->

<Templates xmlns:ows="Microsoft SharePoint">

<Template Name="DEMOTEST" ID="10001">

<Configuration ID="0" Title="Sample Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="This sample template creates a site for teams to create, organize, and share information quickly and easily. It includes a Document Library, and basic lists such as Announcements, Calendar, Contacts, and Quick Links." DisplayCategory="Custom Site Definitions" > </Configuration>

<Configuration ID="1" Title="Sample Blank Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="This sample template creates a Windows SharePoint Services-enabled Web site with a blank home page. You can use a Windows SharePoint Services-compatible Web page editor to add interactive lists or any other Windows SharePoint Services features." DisplayCategory="Custom Site Definitions" > </Configuration>

<Configuration ID="2" Title="Sample Document Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/dwsprev.png" Description="This sample template creates a site for colleagues to work together on documents. It provides a document library for storing the primary document and supporting files, a Task list for assigning to-do items, and a Links list for resources related to the document." DisplayCategory="Custom Site Definitions" > </Configuration>

</Template>

</Templates>

8. Reset IIS

9. Go to SharePoint Central AdministratoràCreate Site Collection. In TemplateSelection
Section, the new tab named ‘Custom Site Definitions’ available.

That’s it...Hope this helps

Adding users to SharePoint Programmatically

Hi All

The code snippet shows you how to add users to SharePoint Programmatically. This code looks for a User who registers with FBA site and Pull them in to SharePoint Group.

[C# code snippet]
MembershipCreateStatus status;
If (Membership.GetUser("UserName") == null)
{
//Insert into MemberShip's Database
Membership.CreateUser("UserName", "Password", "Email", "Not used", "Not used", true, out status);
If (status.ToString().ToLower().Equals("success"))
{
MembershipUser User=Membership.GetUser ("UserName");
Using (SPSite site = new SPSite ("http://sharepoint site url"))
{
Using (SPWeb web = site.OpenWeb())
{
string _usernameWithProvider = String.Format("{0}:{1}", System.Web.Security.Membership.Provider.Name, User.UserName);
web.AllowUnsafeUpdates = true;
SPGroup grp = GetGroup ("Visitor", web); //Visitor is group available with you SharePoint site.
if (grp!= null)
{
web.SiteUsers.Add(_usernameWithProvider, User.Email, User.UserName, "");
web.Groups [group].AddUser(_usernameWithProvider, User.Email, User.UserName, "");

}
}
}
} }

private SPGroup GetGroup(string groupName, SPWeb web)
{
SPGroup spReturn = null;
try
{
spReturn = web.Groups[groupName];
}
catch (Exception ex)
{
return spReturn;
}
return spReturn; }

Hopefully This helps...

AJAX UpdatePanel and SharePoint

Hello Guys,

A Days before i had added ajax update panel in my usercontrol,the usercontrol is render in webpart with sharepoint application.but i can't see the affect of update panel on my sharepoint site,and i got frushtrated.finally i was going for some R&D and got solution.

Basically, the workaround is adding an additional function to your code page that alters the _spFormOnSubmitWrapper and the _spFormOnSumitWrapper So, You need to add following line of code in your Page_Load event and it works for you.

[C# Example]
if (this.Page.Form != null)
{
string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
if (formOnSubmitAtt == “return _spFormOnSubmitWrapper);”)
{
this.Page.Form.Attributes["onsubmit"] = “_spFormOnSubmitWrapper();”;
}
}

ScriptManager.RegisterStartupScript(this, typeof(CompanyRegistration),“UpdatePanelFixup”,“_spOriginalFormAction=document.forms].action;_spSuppressFormOnSubmitWrapper=true;”,true);

That's it...Problem Solved,Hope it works for you.

Error : Code blocks are not allowed in this file

Hi All

I also faced such error in one of SharePoint site when I add one .aspx page, which contains some inline script and code. But at last I found solution for this error. When you add inline script or code in you .aspx page, it works fine as long as the page remain uncustomized in ghosted state. But as soon as you modify any aspect of this page with the SharePoint designer, it turns into unghosted state, WSS then begin to use safe mode to process it. So you just need to add following line of code within the SharePoint section of the web.config file.

<SharePoint>
<SafeMode…>
<PageParserPaths>
<PageParserPath VirtualPath=”Your Page Path” IncludeSubFolder=”true” CompilationMode=”Always” AllowServerSideScript=”true” />
</PageParserPath>
</SafeMode>
</SharePoint>

This Error is very common when you are going add site pages within SharePoint site and make some modification in page with SharePoint Designer.

Hope it will work for you guys. It seems work fine for me.

How to get distinct value from sharepoint list

Hi All,

Here is code which get distinct value from sharepoint list after using CAML Query.

public static DataTable GetShipType()
{
SPWeb web = SPContext.Current.Web
SPQuery qry = new SPQuery();
qry.Query = "";
DataTable dt = lstFloorPlan.GetItems(qry).GetDataTable();
DataView v = new DataView(tbl); return v.ToTable(true, "Type");
}


That's it.You'r done.
Samip.