<?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>dotnet thoughts &#187; sharepoint</title>
	<atom:link href="http://www.dotnetthoughts.net/category/sharepoint/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotnetthoughts.net</link>
	<description>a dotnet developer&#039;s technical blog</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:18:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Add Items to Sharepoint list using Silverlight Object Model</title>
		<link>http://www.dotnetthoughts.net/2010/11/15/how-to-add-items-to-sharepoint-list-using-silverlight-object-model/</link>
		<comments>http://www.dotnetthoughts.net/2010/11/15/how-to-add-items-to-sharepoint-list-using-silverlight-object-model/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 15:36:06 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Silverlight Object Model]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1228</guid>
		<description><![CDATA[Last few days I am working around Silverlight Object Model with sharepoint. In this post I am explaining about adding items to Sharepoint list using Silverlight Object Model. I created a list in sharepoint with few columns like Name, Email &#8230; <a href="http://www.dotnetthoughts.net/2010/11/15/how-to-add-items-to-sharepoint-list-using-silverlight-object-model/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last few days I am working around Silverlight Object Model with sharepoint. In this post I am explaining about adding items to Sharepoint list using Silverlight Object Model. I created a list in sharepoint with few columns like Name, Email and Comments. </p>
<p>And I created a Silverlight application with few textboxes and a submit button.</p>
<div id="attachment_1229" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/11/sl_screen.png"><img src="http://www.dotnetthoughts.net/wp-content/uploads/2010/11/sl_screen-300x98.png" alt="Silverlight Screen" title="Silverlight Screen" width="300" height="98" class="size-medium wp-image-1229" /></a><p class="wp-caption-text">Silverlight Screen</p></div>
<p>Here is the code.</p>
<pre class="brush: csharp; title: ; notranslate">
ClientContext clientContext = null;
Web web = null;
List list = null;

clientContext = new ClientContext(&quot;http://sharepoint:2010&quot;);
web = clientContext.Web;
list = web.Lists.GetByTitle(&quot;samplelist&quot;);
ListItem listItem = list.AddItem(new ListItemCreationInformation());
listItem[&quot;Title&quot;] = Guid.NewGuid().ToString();
listItem[&quot;Name&quot;] = this.txtName.Text;
listItem[&quot;Email&quot;] = this.txtEmail.Text;
listItem[&quot;Comments&quot;] = this.txtcomments.Text;
listItem.Update();
clientContext.Load(list, olist =&gt; olist.Title);
clientContext.ExecuteQueryAsync(
    new ClientRequestSucceededEventHandler(delegate(object o, ClientRequestSucceededEventArgs successargs)
    {
        this.Dispatcher.BeginInvoke(new Action(delegate()
        {
            MessageBox.Show(&quot;New Item Created &quot; + listItem[&quot;Title&quot;]);
        }), null);
    }),
    new ClientRequestFailedEventHandler(delegate(object o, ClientRequestFailedEventArgs failedArgs)
    {
        this.Dispatcher.BeginInvoke(new Action(delegate()
        {
            MessageBox.Show(&quot;New Item creation failed&quot;);
        }), null);
    })
);
</pre>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2010/11/04/how-to-access-sharepoint-list-items-using-silverlight-object-model/" title="Permanent link to How to access SharePoint List Items using Silverlight Object Model">How to access SharePoint List Items using Silverlight Object Model</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/10/26/using-the-silverlight-object-model/" title="Permanent link to Using the Silverlight Object Model">Using the Silverlight Object Model</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/07/15/dropdownlist-findbytext-problem/" title="Permanent link to Dropdownlist FindByText Problem">Dropdownlist FindByText Problem</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/11/05/hosting-silverlight-application-in-sharepoint-2010/" title="Permanent link to Hosting Silverlight application in Sharepoint 2010">Hosting Silverlight application in Sharepoint 2010</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/10/11/silverlight-in-sharepoint-wss-3-0/" title="Permanent link to Silverlight in Sharepoint (WSS 3.0)">Silverlight in Sharepoint (WSS 3.0)</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/11/15/how-to-add-items-to-sharepoint-list-using-silverlight-object-model/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to access SharePoint List Items using Silverlight Object Model</title>
		<link>http://www.dotnetthoughts.net/2010/11/04/how-to-access-sharepoint-list-items-using-silverlight-object-model/</link>
		<comments>http://www.dotnetthoughts.net/2010/11/04/how-to-access-sharepoint-list-items-using-silverlight-object-model/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 15:36:01 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Sharepoint API]]></category>
		<category><![CDATA[Silverlight Object Model]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1199</guid>
		<description><![CDATA[In the last postI introduced the Silverlight Object Model, which helps to access the SharePoint objects directly from Silverlight. In this I am posting about how to access SharePoint List Items using Silverlight Object Model. In this I am using &#8230; <a href="http://www.dotnetthoughts.net/2010/11/04/how-to-access-sharepoint-list-items-using-silverlight-object-model/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.dotnetthoughts.net/2010/10/26/using-the-silverlight-object-model/">last post</a>I introduced the Silverlight Object Model, which helps to access the SharePoint objects directly from Silverlight. In this I am posting about how to access SharePoint List Items using Silverlight Object Model. In this I am using Caml query object, which is used to get the Fields.</p>
<pre class="brush: csharp; title: ; notranslate">
private Web oWebSite = null;
private List oList = null;
private ListItemCollection oListItems = null;
private ClientContext clientContext = null;

this.clientContext = ClientContext.Current;
if (this.clientContext == null)
{
this.clientContext = new ClientContext(url);
}
using (this.clientContext)
{
this.oWebSite = clientContext.Web;
this.oList = this.oWebSite.Lists.GetByTitle(this.listName);
this.oListItems = this.oList.GetItems(CamlQuery.CreateAllItemsQuery());
    clientContext.Load(this.oListItems);
clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed);
}

private void onQuerySucceeded(object sender, ClientRequestSucceededEventArgs args)
{
//FillItems method converts the List items to Class Properties
//and binds them to the Silverlight User Interface.
this.Dispatcher.BeginInvoke(new Action(FillItems));
}

private void onQueryFailed(object sender, ClientRequestFailedEventArgs args)
{
MessageBox.Show(&quot;An error occured.\n&quot; + args.Message + &quot;\n&quot; + args.StackTrace);
}
</pre>
<p>And if you don&#8217;t want all the columns or you want to specify the columns you want to access you can use Caml Query object&#8217;s ViewXml property.</p>
<pre class="brush: csharp; title: ; notranslate">
CamlQuery camlQuery = new CamlQuery();
string query = &quot;&lt;OrderBy&gt;&lt;FieldRef Name='Name' Ascending='False' /&gt;&lt;/OrderBy&gt;&quot;;
camlQuery.ViewXml = query;
this.oListItems = this.oList.GetItems(camlQuery);
</pre>
<p>You can access CustomLists and Document Libraries by this method.</p>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2010/10/26/using-the-silverlight-object-model/" title="Permanent link to Using the Silverlight Object Model">Using the Silverlight Object Model</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/11/15/how-to-add-items-to-sharepoint-list-using-silverlight-object-model/" title="Permanent link to How to Add Items to Sharepoint list using Silverlight Object Model">How to Add Items to Sharepoint list using Silverlight Object Model</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/09/20/drag-and-drop-in-silverlight-3/" title="Permanent link to Drag and Drop in Silverlight 3">Drag and Drop in Silverlight 3</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/01/06/file-uploader-using-silverlight-and-wcf/" title="Permanent link to File Uploader using Silverlight and WCF">File Uploader using Silverlight and WCF</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/11/05/hosting-silverlight-application-in-sharepoint-2010/" title="Permanent link to Hosting Silverlight application in Sharepoint 2010">Hosting Silverlight application in Sharepoint 2010</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/11/04/how-to-access-sharepoint-list-items-using-silverlight-object-model/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using the Silverlight Object Model</title>
		<link>http://www.dotnetthoughts.net/2010/10/26/using-the-silverlight-object-model/</link>
		<comments>http://www.dotnetthoughts.net/2010/10/26/using-the-silverlight-object-model/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 15:30:42 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Sharepoint API]]></category>
		<category><![CDATA[Silverlight Object Model]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1192</guid>
		<description><![CDATA[Recently I moved to a new project where I have to integrate Silverlight with SharePoint. I had done a few posts regarding this also. Yesterday I found that in SharePoint 2010(SharePoint foundation), Microsoft introduces Silverlight Object Model which helps to &#8230; <a href="http://www.dotnetthoughts.net/2010/10/26/using-the-silverlight-object-model/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I moved to a new project where I have to integrate Silverlight with SharePoint. I had done a few posts regarding this also. Yesterday I found that in SharePoint 2010(SharePoint foundation), Microsoft introduces Silverlight Object Model which helps to access SharePoint Lists and Document Libraries directly from Silverlight.</p>
<p>Here is my first experiment with Silverlight Object Model which helps to retrieve all the Lists from a given SharePoint site, and displays it in a Combo Box.</p>
<pre class="brush: csharp; title: ; notranslate">
private Web oWebSite;
private ListCollection collList;
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
    using (ClientContext clientContext = new ClientContext(&quot;http://sharepoint2010/&quot;))
    {
        this.oWebSite = clientContext.Web;
        this.collList = this.oWebSite.Lists;
        clientContext.Load(collList);
        clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed);
    }
}

private void onQuerySucceeded(object sender, ClientRequestSucceededEventArgs args)
{
    this.Dispatcher.BeginInvoke(new Action(DisplayLists));
}
private void onQueryFailed(object sender, ClientRequestFailedEventArgs args)
{
    MessageBox.Show(&quot;An error occured.\n&quot; + args.Message + &quot;\n&quot; + args.StackTrace);
}

private void DisplayLists()
{
    foreach (List item in collList)
    {
        lstItems.Items.Add(item.Title);
    }
}
</pre>
<p>Because query execution is asynchronous when you use the SharePoint Foundation Silverlight object model, you must pass delegates for callback methods as parameters in the ExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler) method.</p>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2010/11/04/how-to-access-sharepoint-list-items-using-silverlight-object-model/" title="Permanent link to How to access SharePoint List Items using Silverlight Object Model">How to access SharePoint List Items using Silverlight Object Model</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/11/15/how-to-add-items-to-sharepoint-list-using-silverlight-object-model/" title="Permanent link to How to Add Items to Sharepoint list using Silverlight Object Model">How to Add Items to Sharepoint list using Silverlight Object Model</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/11/05/hosting-silverlight-application-in-sharepoint-2010/" title="Permanent link to Hosting Silverlight application in Sharepoint 2010">Hosting Silverlight application in Sharepoint 2010</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/09/20/drag-and-drop-in-silverlight-3/" title="Permanent link to Drag and Drop in Silverlight 3">Drag and Drop in Silverlight 3</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/10/11/silverlight-in-sharepoint-wss-3-0/" title="Permanent link to Silverlight in Sharepoint (WSS 3.0)">Silverlight in Sharepoint (WSS 3.0)</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/10/26/using-the-silverlight-object-model/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Silverlight in Sharepoint (WSS 3.0)</title>
		<link>http://www.dotnetthoughts.net/2010/10/11/silverlight-in-sharepoint-wss-3-0/</link>
		<comments>http://www.dotnetthoughts.net/2010/10/11/silverlight-in-sharepoint-wss-3-0/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 03:39:02 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WSS 3.0]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1168</guid>
		<description><![CDATA[Recently I got an assignment to integrate Silverlight to WSS 3.0, in Sharepoint Foundation(WSS 4.0) there is an out of the box web part available to do the integration. Instead of using that, in this post I am creating a &#8230; <a href="http://www.dotnetthoughts.net/2010/10/11/silverlight-in-sharepoint-wss-3-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Recently I got an assignment to integrate Silverlight to WSS 3.0, in Sharepoint Foundation(WSS 4.0) there is an out of the box web part available to do the integration. Instead of using that, in this post I am creating a reusable web part which helps to load Silverlight application in SharePoint. It is lot similar like smart part web part in WSS, which helps to render dotnet user controls (ACSX) files as webparts.</p>
<p style="text-align: justify;">Here is my web part code. It uses two JavaScript files as includes, first one the Silverlight.js, which is used by the Silverlight runtime, other one contains the script part which handles any error. Both of this files need to copied to LAYOUTS folder so that we can re-use the code to any application in the server.</p>
<pre class="brush: csharp; title: ; notranslate">
public class SilverlightWebpart : WebPart
{
    private string _xapFileName = string.Empty;
    private int _contentHeight = 100;
    private int _contentWidth = 200;
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        ClientScriptManager _ClientScriptManager = Page.ClientScript;
        if (!_ClientScriptManager.IsClientScriptIncludeRegistered(&quot;sl_javascript&quot;))
            _ClientScriptManager.RegisterClientScriptInclude(this.GetType(), &quot;sl_javascript&quot;, &quot;/_LAYOUTS/SL3/Silverlight.js&quot;);
        if (!_ClientScriptManager.IsClientScriptBlockRegistered(&quot;SilverlightError&quot;))
        {
            _ClientScriptManager.RegisterClientScriptInclude(this.GetType(), &quot;SilverlightError&quot;, &quot;/_LAYOUTS/SL3/SilverlightError.js&quot;);
        }

    }

    public override void RenderControl(HtmlTextWriter writer)
    {
        writer.WriteLine( string.Format(&quot;&lt;/pre&gt;
&lt;div id=&quot;\&amp;quot;silverlightControlHost\&amp;quot;&quot; style=&quot;_0height: {0};&quot;&gt;&quot;,
 this._contentHeight.ToString(), this._contentWidth.ToString()));
 writer.WriteLine(&quot;&lt;object width=&quot;\&amp;quot;100%\&amp;quot;&quot; height=&quot;\&amp;quot;100%\&amp;quot;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot;&gt;&lt;param name=&quot;&amp;quot;source&amp;quot;&quot; value=&quot;\&amp;quot;{0}\&amp;quot;/&quot; /&gt;&lt;param name=&quot;&amp;quot;onError&amp;quot;&quot; value=&quot;\&amp;quot;onSilverlightError\&amp;quot;&quot; /&gt;&lt;param name=&quot;&amp;quot;background&amp;quot;&quot; value=&quot;\&amp;quot;white\&amp;quot;&quot; /&gt;&lt;param name=&quot;&amp;quot;minRuntimeVersion&amp;quot;&quot; value=&quot;\&amp;quot;3.0.40818.0\&amp;quot;&quot; /&gt;&lt;param name=&quot;&amp;quot;autoUpgrade&amp;quot;&quot; value=&quot;\&amp;quot;true\&amp;quot;&quot; /&gt;&lt;param name=&quot;src&quot; value=&quot;\&amp;quot;data:application/x-silverlight-2,\&amp;quot;&quot; /&gt;&lt;embed width=&quot;\&amp;quot;100%\&amp;quot;&quot; height=&quot;\&amp;quot;100%\&amp;quot;&quot; type=&quot;application/x-shockwave-flash&quot; src=&quot;\&amp;quot;data:application/x-silverlight-2,\&amp;quot;&quot; &quot;source&quot;=&quot;\&amp;quot;{0}\&amp;quot;/&quot; &quot;onError&quot;=&quot;\&amp;quot;onSilverlightError\&amp;quot;&quot; &quot;background&quot;=&quot;\&amp;quot;white\&amp;quot;&quot; &quot;minRuntimeVersion&quot;=&quot;\&amp;quot;3.0.40818.0\&amp;quot;&quot; &quot;autoUpgrade&quot;=&quot;\&amp;quot;true\&amp;quot;&quot; /&gt;&quot;); writer.WriteLine(string.Format(&quot;&quot;, this._xapFileName)); writer.WriteLine(&quot;&quot;); writer.WriteLine(&quot;&quot;); writer.WriteLine(&quot;&quot;); writer.WriteLine(&quot;&quot;); writer.WriteLine(&quot;&lt;a href=&quot;\&amp;quot;http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40818.0\&amp;quot;&quot; style=&quot;\&amp;quot; text-decoration:none\&amp;quot;&quot;&gt;&quot;); writer.WriteLine(&quot;&lt;img src=&quot;\&amp;quot;http://go.microsoft.com/fwlink/?LinkId=161376\&amp;quot;&quot; alt=&quot;\&amp;quot; Get&quot; style=&quot;\&amp;quot;border-style:none\&amp;quot;/&quot; /&gt;&quot;); writer.WriteLine(&quot;&lt;/a&gt;&quot;); writer.WriteLine(&quot;&lt;/object&gt;&lt;iframe id=&quot;\&amp;quot;_sl_historyFrame\&amp;quot;&quot; style=&quot;_0visibility: hidden; height: 0px; width: 0px; border: 0px\&amp;quot;;&quot; width=&quot;320&quot; height=&quot;240&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;pre&gt;
&quot;);
    }

    [WebBrowsable(true),
    WebDescription(&quot;Specify the Height of the XAP File Content&quot;),
    WebDisplayName(&quot;Content Height&quot;),
    Personalizable(PersonalizationScope.User)]
    public int ContentHeight
    {
        get
        {
            return this._contentHeight;
        }
        set
        {
            this._contentHeight = value;
        }
    }

    [WebBrowsable(true),
    WebDescription(&quot;Specify the Width of the XAP File Content&quot;),
    WebDisplayName(&quot;Content Width&quot;),
    Personalizable(PersonalizationScope.User)]
    public int ContentWidth
    {
        get
        {
            return this._contentWidth;
        }
        set
        {
            this._contentWidth = value;
        }
    }

    [WebBrowsable(true),
    WebDescription(&quot;Specify the XAP File to load&quot;),
    WebDisplayName(&quot;XAP File Name&quot;),
    Personalizable(PersonalizationScope.User)]
    public string XAPFile
    {
        get
        {
            return this._xapFileName;
        }
        set
        {
            this._xapFileName = value;
        }
    }
}
</pre>
<p style="text-align: justify;">The code is pretty self-explanatory. After deploying the webpart and adding the webpart to the Page, select Modify Shared Webpart, you will get Sharepoint customize option like this.</p>
<div id="attachment_1170" class="wp-caption alignnone" style="width: 551px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/Customize_Silverlight_webpart.png"><img class="size-full wp-image-1170" title="Customize Silverlight Webpart" src="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/Customize_Silverlight_webpart.png" alt="Customize Silverlight Webpart" width="541" height="530" /></a><p class="wp-caption-text">Customize Silverlight Webpart</p></div>
<p>Please make sure you created a Folder with name SL3 in the _LAYOUTS folder, and copied the two javascript files to the location. The output of the Silverlight project also you need to copy to the Folder. The location will be C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\SL3. Specify the XAP File Name property as the XAP File copied to SL3 folder from ClientBin folder. You can also modify the Height and Width of the silverlight application. Click Apply and OK, exit from Edit Mode. The Silverlight application is integrated to sharepoint.</p>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2010/11/15/how-to-add-items-to-sharepoint-list-using-silverlight-object-model/" title="Permanent link to How to Add Items to Sharepoint list using Silverlight Object Model">How to Add Items to Sharepoint list using Silverlight Object Model</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/11/03/simple-url-rewriting-in-asp-net-with-csharp/" title="Permanent link to Simple URL Rewriting in ASP.Net with C#">Simple URL Rewriting in ASP.Net with C#</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/11/26/how-to-upload-file-using-httpwebrequest-class/" title="Permanent link to How to upload file using HttpWebRequest class">How to upload file using HttpWebRequest class</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/06/21/asp-net-default-button-and-master-pages/" title="Permanent link to ASP.Net Default button and Master Pages">ASP.Net Default button and Master Pages</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/11/10/post-data-using-httpwebrequest-in-c-sharp/" title="Permanent link to Post data using HttpWebRequest in C#">Post data using HttpWebRequest in C#</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/10/11/silverlight-in-sharepoint-wss-3-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating a WebPart using Visual Web Developer Express</title>
		<link>http://www.dotnetthoughts.net/2010/10/09/creating-a-webpart-using-visual-web-developer-express/</link>
		<comments>http://www.dotnetthoughts.net/2010/10/09/creating-a-webpart-using-visual-web-developer-express/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 05:02:36 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Visual Web Developer 2010]]></category>
		<category><![CDATA[Web Part]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1143</guid>
		<description><![CDATA[Recently I installed the WSS 3.0 in my machine. In this post I am talking about how to develop a web part using Visual Web Developer express, which can be deployed in WSS 3.0. From ASP.Net 2.0 onwards WSS Sharepoint &#8230; <a href="http://www.dotnetthoughts.net/2010/10/09/creating-a-webpart-using-visual-web-developer-express/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span>Recently I installed the WSS 3.0 in my machine. In this post I am talking about how to develop a web part using Visual Web Developer express, which can be deployed in WSS 3.0. From ASP.Net 2.0 onwards WSS <span>Sharepoint</span> class is inheriting from <span>WebPart</span> class in ASP.Net, but the <span>Sharepoint</span> <span>WebPart</span> class contains more features to create connected <span>WebParts</span> etc.</span></p>
<ol>
<li>Create a Class Library project in VWD Express; I am using VWD 2010, and after creating the project make sure you choose the Target framework as  .Net Framework 2.0. Otherwise you may get some unable to load target assembly error from WSS.</li>
<li>Add Reference of System.Web.</li>
<li><span>Create a Class and inherit that from <span>WebPart</span> class, which is available in System.Web.UI.<span>WebControls</span>.<span>WebParts</span> <span>namespace</span>.</span></li>
<li><span>Override the <span>CreateChildControls</span>() method, which helps to add /setup ASP.Net controls to the <span>webpart</span>, also you need to override the <span>RenderControl</span>() method, which helps to render the control to the Page.</span></li>
<pre class="brush: csharp; title: ; notranslate">
public class SampleWebPart : WebPart
{
    private TextBox t;
    private Calendar c;
    private DateTime _userDOB = DateTime.Now;
    protected override void CreateChildControls()
    {
        this.t = new TextBox();
        t.Text = this._userDOB.ToString();
        this.c = new Calendar();
        c.SelectionChanged += new System.EventHandler(c_SelectionChanged);
        this.Controls.Add(t);
        this.Controls.Add(c);
    }

    void c_SelectionChanged(object sender, System.EventArgs e)
    {
        this.t.Text = this.c.SelectedDate.ToString();
    }

    public override void RenderControl(HtmlTextWriter writer)
    {
        RenderChildren(writer);
    }

    [WebBrowsable(true),
    WebDescription(&quot;Date of Birth of the User&quot;),
    WebDisplayName(&quot;DOB&quot;),
    Personalizable(PersonalizationScope.User)]
    public DateTime UserDOB
    {
        get
        {
            return _userDOB;
        }
        set
        {
            _userDOB = value;
        }
    }
}
</pre>
<li><span>Build the assembly; put the DLL to the bin of your Website, most probably it will be located in C:\<span>inetpub</span>\<span>wwwroot</span>\<span>wss</span>\<span>VirtualDirectories</span>\{port}\</span></li>
<li><span>Also you need to make the assembly into the <span>SafeControl</span> list of the web.<span>config</span> file of the website, which will be in C:\<span>inetpub</span>\<span>wwwroot</span>\<span>wss</span>\<span>VirtualDirectories</span>\{port}\ this location.</span></li>
<div id="attachment_1148" class="wp-caption alignleft" style="width: 908px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/safecontrol.png"><img class="size-full wp-image-1148" title="Add Assembly to Safe Control list" src="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/safecontrol.png" alt="Add Assembly to Safe Control list" width="898" height="53" /></a><p class="wp-caption-text">Add Assembly to Safe Control list</p></div>
<li><span>Now you need to import the <span>WebPart</span> in WSS, you need to Select the Site Actions &gt; Site Settings &gt; Web Parts page. This page will display all the <span>webparts</span> available in the Website. You need to click on the New Link. And from the New Web Parts page, you need to select the new web part you added to the Bin folder.</span></li>
<div id="attachment_1145" class="wp-caption alignleft" style="width: 1166px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/newwebpart.png"><img class="size-full wp-image-1145" title="Add New Web Part" src="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/newwebpart.png" alt="Add New Web Part" width="1156" height="173" /></a><p class="wp-caption-text">Add New Web Part</p></div>
<li><span>The selected <span>webpart</span> will be added to the Web Part Gallery.</span></li>
<div id="attachment_1146" class="wp-caption alignleft" style="width: 796px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/newwebpart2.png"><img class="size-full wp-image-1146" title="New WebPart in WebPart Gallery" src="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/newwebpart2.png" alt="New WebPart in WebPart Gallery" width="786" height="46" /></a><p class="wp-caption-text">New WebPart in WebPart Gallery</p></div>
<li><span>Now go to any page, select the Edit Page option from Site Actions. Click on the Add Web Part button, and you can see the newly added web part in the Add <span>WebPart</span> dialog.</span></li>
<div id="attachment_1147" class="wp-caption alignleft" style="width: 718px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/newwebpart3.png"><img class="size-full wp-image-1147" title="New WebPart in Add Web Part Dialog" src="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/newwebpart3.png" alt="New WebPart in Add Web Part Dialog" width="708" height="737" /></a><p class="wp-caption-text">New WebPart in Add Web Part Dialog</p></div>
</ol>
<p><br clear="all" /><br />
And this is the web part running on my home page.</p>
<p><div id="attachment_1159" class="wp-caption alignleft" style="width: 306px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/output.png"><img class="size-full wp-image-1159" title="Web Part in my Home Page" src="http://www.dotnetthoughts.net/wp-content/uploads/2010/10/output.png" alt="Web Part in my Home Page" width="296" height="197" /></a><p class="wp-caption-text">Web Part in my Home Page</p></div><br />
<br clear="all" /><br />
<span>The attributed defined in the &#8220;<span>UserDOB</span>&#8221; property helps to customize the web part.</span></p>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2011/10/11/open-visual-studio-files-as-administrator/" title="Permanent link to Open Visual Studio Files As Administrator">Open Visual Studio Files As Administrator</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2008/05/24/image-viewer-in-wpf-part-i-selecting-multiple-files-with-fileopen-dialog/" title="Permanent link to Image viewer in WPF &#8211; Part I (Selecting multiple files with FileOpen Dialog)">Image viewer in WPF &#8211; Part I (Selecting multiple files with FileOpen Dialog)</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2008/08/28/page-methods-in-aspnet/" title="Permanent link to Page methods in ASP.Net">Page methods in ASP.Net</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2007/05/05/javascript-confirm-dialogs-from-link-buttons-of-datagrid/" title="Permanent link to Javascript confirm dialogs from link buttons of Datagrid">Javascript confirm dialogs from link buttons of Datagrid</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2008/05/07/increase-your-productivity-using-visual-studio-code-snippets/" title="Permanent link to Increase your productivity using Visual Studio code snippets">Increase your productivity using Visual Studio code snippets</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/10/09/creating-a-webpart-using-visual-web-developer-express/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

