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.