<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sharepoint Server &#187; Picture Library</title>
	<atom:link href="http://www.fivenumber.com/tag/picture-library/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fivenumber.com</link>
	<description>It&#039;s all about SharePoint</description>
	<lastBuildDate>Tue, 03 Jan 2012 16:33:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<image>
<link>http://www.fivenumber.com</link>
<url>http://www.fivenumber.com/wp-content/mbp-favicon/5.jpg</url>
<title>Sharepoint Server</title>
</image>
		<item>
		<title>Custom Webpart &#8211; Displays the latest image from picture library</title>
		<link>http://www.fivenumber.com/custom-webpart-displays-the-latest-image-from-picture-library/</link>
		<comments>http://www.fivenumber.com/custom-webpart-displays-the-latest-image-from-picture-library/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 09:51:49 +0000</pubDate>
		<dc:creator>GVK</dc:creator>
				<category><![CDATA[MOSS - Object Model]]></category>
		<category><![CDATA[Custom Webparts]]></category>
		<category><![CDATA[Picture Library]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://www.fivenumber.com/?p=410</guid>
		<description><![CDATA[Here is the simple custom webpart which displays the latest image from picture library. Download complete source code using System; using System.Runtime.InteropServices; using System.Web.UI; using System.Web.UI.WebControls.WebParts; using System.Xml.Serialization; using System.Web.UI.WebControls; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.WebPartPages; namespace LatestImage { [Guid("8c21451d-1763-4a7f-817c-f4330a5b1fd8")] public class LatestImage : System.Web.UI.WebControls.WebParts.WebPart { Image myimage = new Image(); protected override void CreateChildControls() [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the simple custom webpart which displays the latest image from picture library.</p>
<div id="attachment_411" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.fivenumber.com/wp-content/uploads/2008/10/52.gif" rel="lightbox[410]"><img class="size-medium wp-image-411" title="Latest Image - Displays the latest image from Picture Library" src="http://www.fivenumber.com/wp-content/uploads/2008/10/52-300x234.gif" alt="Latest Image - Displays the latest image from Picture Library" width="300" height="234" /></a><p class="wp-caption-text">Latest Image - Displays the latest image from Picture Library</p></div>
<p><a title="Latest Image Webpart Code" href="http://www.fivenumber.com/wp-content/uploads/2008/10/latestimagewebpart.txt" target="_blank">Download complete source code</a></p>
<pre name="code" class="c-sharp">
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
namespace LatestImage
{
    [Guid("8c21451d-1763-4a7f-817c-f4330a5b1fd8")]
    public class LatestImage : System.Web.UI.WebControls.WebParts.WebPart
    {
        Image myimage = new Image();
        protected override void CreateChildControls()
        {
            myimage.Height = 256;
            myimage.Width = 256;
            SPSite mysite = new SPSite("http://"+System.Environment.MachineName);
            mysite = SPControl.GetContextSite(Context);
            SPWeb myweb = mysite.OpenWeb();
            SPList mylist=myweb.Lists["Pic Lib"];
            SPQuery myquery = new SPQuery();
            myquery.Query = "";
            string serverpath=mysite.ServerRelativeUrl.ToString();
            SPListItemCollection mylistitem = mylist.GetItems(myquery);
            if (mylistitem.Count > 0)
            {
                myimage.ImageUrl = serverpath + mylistitem[mylistitem.Count - 1].Url.ToString();
            }
            else
            {
                this.Page.Response.Write("No image found");
            }
            base.CreateChildControls();
        }
        protected override void Render(HtmlTextWriter writer)
        {
            myimage.RenderControl(writer);
            // TODO: add custom rendering code here.
            // writer.Write("Output HTML");
        }
    }
}
</pre>
<link type="text/css" rel="stylesheet" href="css/SyntaxHighlighter.css"></link>
<script language="javascript" src="js/shCore.js"></script><br />
<script language="javascript" src="js/shBrushCSharp.js"></script><br />
<script language="javascript" src="js/shBrushXml.js"></script><br />
<script language="javascript">
dp.SyntaxHighlighter.ClipboardSwf = '/flash/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fivenumber.com/custom-webpart-displays-the-latest-image-from-picture-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

