SharePoint - Picture Library - How to copy picture from one Picture Library to another

Hi All,

Here it is interesting blog post of an eventhandler.Below is the requirement for the task.

There are two picture libraries available, i need to copy picture from one library to another when picture is going to upload in picture library.For that i've created "ItemAdded" event handler and do code on this event.

You can find the code below:

public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
try
{
SPListItem item = properties.ListItem;
byte[] picFile = null;
SPFolder Sourcelibrary = item.Web.Folders[name of the source picture library];
picFile = item.File.OpenBinary();
if (picFile != null && picFile.Length > 0)
{
SPFolder DestLibrary = item.Web.Folders[name of the destination picture library];
item.Web.AllowUnsafeUpdates = true;
DestLibrary.Files.Add(System.IO.Path.GetFileName(item.File.Name), picFile);
}
}
catch (Exception)
{
throw;
}
}

How to show a file extension within a document library

Hi All,

In SharePoint Document Library, the file extension is not display when you upload any new documents. To show the file with extension, Following steps need to implement:

1. Open up the .aspx file responsible for displaying the document list in Sharepoint Designer, in my case it is called AllItems.aspx

2. Select the WebPartPages:ListViewWebPart control. (It is the place where rows of document are listed)

3. Right-click on it, Convert to XSLT Data View

4. Go into the code and find the line that says:

<xsl:value-of select="ddwrt:UrlBaseName(string(@LinkFilename))" />

5. Add this to the end of the line:

.<xsl:value-of select="@File_x0020_Type" />

6. Save

Hope it will helpful to you.


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.