<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Yaroslav Pentsarskyy on SharePoint Development</title>
	
	<link>http://www.sharemuch.com</link>
	<description>Yaroslav writes about his SharePoint developer findings</description>
	<lastBuildDate>Sun, 05 Sep 2010 05:05:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/YaroslavPentsarskyysDevelopmentBlog" /><feedburner:info uri="yaroslavpentsarskyysdevelopmentblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Automatically inherit SharePoint web parts from page layouts to child pages</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/0F_QKJek85I/</link>
		<comments>http://www.sharemuch.com/2010/09/04/automatically-inherit-sharepoint-web-parts-from-page-layouts-to-child-pages/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 05:05:59 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[inherit page layout webparts]]></category>
		<category><![CDATA[provision webparts]]></category>
		<category><![CDATA[webpart in page layout]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1403</guid>
		<description><![CDATA[When building publishing site using SharePoint 2010 it&#8217;s quite common to have few web parts that will make it to every page (or close to every page) on the site. An example could be a custom secondary navigation which you &#8230; <a href="http://www.sharemuch.com/2010/09/04/automatically-inherit-sharepoint-web-parts-from-page-layouts-to-child-pages/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<p>When building publishing site using SharePoint 2010 it&#8217;s quite common to have few web parts that will make it to every page (or close to every page) on the site. An example could be a custom secondary navigation which you may choose to make a web part to allow some user configuration. This means you need to provision such web part on each and every page that requires it &#8211; right? Well, there is another solution. What you can do is to define your web part in a page layout module just like you would in a page. In MOSS this trick would ensure your web part will make it to every page that inherits your custom layout; not so in SharePoint 2010.</p>
<p>One solution to that is to define the web part in the page layout, and programmatically copy web parts from page layout to pages inheriting them. In my case I will demonstrate how to achieve this by a feature receiver inside a feature that will be activate in site template during site creation. This way every time the site is created and pages are provisioned &#8211; my feature receiver will copy web parts from page layout to those newly created pages.</p>
<p>Here is the body of my feature receiver:</p>
<pre>public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
    SPWeb web = properties.Feature.Parent as SPWeb;</pre>
<pre>    if (null != web)
    {
        PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web);
        SPList pages = pubWeb.PagesList;</pre>
<pre>        foreach (SPListItem page in pages.Items)
        {
            PublishingPage pubPage = PublishingPage.GetPublishingPage(page);
            pubPage.CheckOut();
            CopyWebParts(pubPage.Url, web, pubPage.Layout.ServerRelativeUrl,
pubPage.Layout.ListItem.Web);
            pubPage.CheckIn("Webparts copied from page layout");
        }
    }
}</pre>
<pre>private void CopyWebParts(string pageUrl, SPWeb pageWeb,
string pageLayoutUrl, SPWeb pageLayoutWeb)
{
    SPWeb web = null;
    SPWeb web2 = null;
    SPpageWebPartManager pageWebPartManager =
pageWeb.GetpageWebPartManager(pageUrl, PersonalizationScope.Shared);
    SPpageWebPartManager pageLayoutWebPartManager =
pageLayoutWeb.GetpageWebPartManager(pageLayoutUrl, PersonalizationScope.Shared);
    web2 = pageWebPartManager.Web;
    web = pageLayoutWebPartManager.Web;
    SPLimitedWebPartCollection webParts = pageLayoutWebPartManager.WebParts;
    SPLimitedWebPartCollection parts2 = pageWebPartManager.WebParts;
    foreach (System.Web.UI.WebControls.WebParts.WebPart part in webParts)
    {
        if (!part.IsClosed)
        {
            System.Web.UI.WebControls.WebParts.WebPart webPart = parts2[part.ID];
            if (webPart == null)
            {
                string zoneID = pageLayoutWebPartManager.GetZoneID(part);
                pageWebPartManager.AddWebPart(part, zoneID, part.ZoneIndex);
            }
        }
    }
}
</pre>
<p>Now, it&#8217;s up to you if you activate this feature manually under each web, or automate it according to your scenario; one thing for sure &#8211; once the feature is active &#8211; your web parts will be copied to pages inheriting the layout they were defined.</p>
<p>Good Luck!</p>

<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/0F_QKJek85I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/09/04/automatically-inherit-sharepoint-web-parts-from-page-layouts-to-child-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/09/04/automatically-inherit-sharepoint-web-parts-from-page-layouts-to-child-pages/</feedburner:origLink></item>
		<item>
		<title>Creating WCF service in SharePoint 2010</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/jwVzT-8PF98/</link>
		<comments>http://www.sharemuch.com/2010/08/31/creating-wcf-service-in-sharepoint-2010/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 02:35:32 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[rest service on sharepoint]]></category>
		<category><![CDATA[sharepoint hosted wcf]]></category>
		<category><![CDATA[wcf]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1393</guid>
		<description><![CDATA[Whether you already tried creating WCF service as a standalone website project or WCF library &#8211; creating SharePoint hosted WCF add whole new meaning to it Suppose you want to create a service which you can call using URL and &#8230; <a href="http://www.sharemuch.com/2010/08/31/creating-wcf-service-in-sharepoint-2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<p>Whether you already tried creating WCF service as a standalone website project or WCF library &#8211; creating SharePoint hosted WCF add whole new meaning to it <img src='http://www.sharemuch.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Suppose you want to create a service which you can call using URL and receive and XML or JSON back in your browser or JavaScript app.</p>
<p>I&#8217;ll demonstrate the process step by step:</p>
<p>In our case we&#8217;ll call </p>
<pre>http://localhost/_vti_bin/Service1.svc/MyCall?message=Some Text</pre>
<p><span style="font-family: Consolas; color: #008000; font-size: x-small;"><span style="font-family: Consolas; color: #008000; font-size: x-small;"><span style="font-family: Consolas; color: #008000; font-size: x-small;"> </span></span></span> and receive</p>
<pre>&lt;string xmlns="http://schemas.microsoft.com/2003/10/Serialization/"&gt;</pre>
<pre>You entered: Some Text, Entered on: 8/31/2010 7:19:29 PM&lt;/string&gt;</pre>
<p>1. Create new Visual Studio 2010 Blank SharePoint project.</p>
<p>2. Map a new SharePoint folder in your solution &#8211; it&#8217;ll be ISAPI folder. That&#8217;s where our Service definition is going to sit.</p>
<p>3. Add a new Text file in the newly mapped ISAPI folder. Rename the text file to SVC extension and add the following code to it:</p>
<pre>&lt;%</pre>
<pre>@ServiceHost Language="C#" Debug="true" Service="<span style="color: #ff0000;">WCFOnSP.Service1, </span></pre>
<pre><span style="color: #ff0000;">WCFOnSP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=45738fb2ebc34cfd</span>" </pre>
<pre>Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory,</pre>
<pre>Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral,</pre>
<pre>PublicKeyToken=71e9bce111e9429c" %&gt;</pre>
<p>Ensure you replace <span style="color: #ff0000;">highlighted </span>parts with valid assembly information and namespaces.</p>
<p>4. Add the following references to your project:</p>
<p>Microsoft.SharePoint.Client.ServerRuntime.DLL &#8211; (<em>C:\Windows\assembly\GAC_MSIL\Microsoft.SharePoint.Client.ServerRuntime\ </em><em>14.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.ServerRuntime.dll</em>)</p>
<p>System.ServiceModel.DLL</p>
<p>System.ServiceModel.Web.DLL</p>
<p>5. Add a new folder to your solution called WCF Service (or anything else). This is where we`re going to place our service classes and contract.</p>
<p>6. Add new class called <strong>IService1.cs </strong>- which is the service contract. Replace it`s code with the following:
<pre>using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;</pre>
<pre>namespace WCFOnSP
{
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        [WebGet(UriTemplate = "/MyCall?message={message}",
            BodyStyle = WebMessageBodyStyle.Bare,
            ResponseFormat = WebMessageFormat.Xml)]
        string GetData(string message);</pre>
<pre>        // TO Call this method - deploy the solution and call the following URL:
        // <a href="http://localhost/_vti_bin/Service1.svc/MyCall?message=Some">http://localhost/_vti_bin/Service1.svc/MyCall?message=Some</a> Text
    }</pre>
<pre>}</pre>
<p>Pretty self explanatory &#8211; I event included a comment on what`s the call syntax. <strong>WebMessageFormat.Xml </strong>will determine if the return is XML or JSON &#8211; so this is how you toggle it.</p>
<p>7. Now let`s implement the REST call method. Create new class in the same folder as your contract &#8211; name the file: <strong>Service1.cs</strong>, replace it`s content with the following:</p>
<pre>using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Activation;
using Microsoft.SharePoint.Client.Services;</pre>
<pre>namespace WCFOnSP
{

    [BasicHttpBindingServiceMetadataExchangeEndpointAttribute]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]</pre>
<pre>    public class Service1 : IService1
    {
        public string GetData(string message)
        {
            return string.Format("You entered: {0}, Entered on: {1}", message,  DateTime.Now.ToString());
        }</pre>
<pre>    }
}</pre>
<p>Also, pretty self explanatory &#8211; this method can really execute anything as long as it returns a string value. Attributes on a top of the class will ensure the service has necessary resources to run within the environment &#8211; which you normally get by default in SP 2010.</p>
<p>That`s all there is to it &#8211; deploy your solution and use the calling URL from above &#8211; you should get your desired message in XML. Now you can consume the XML or JSON in your application.</p>
<p>Good Luck!</p>

<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/jwVzT-8PF98" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/31/creating-wcf-service-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/08/31/creating-wcf-service-in-sharepoint-2010/</feedburner:origLink></item>
		<item>
		<title>Getting started with WCF services on SharePoint 2010</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/KYL2NNd2CEw/</link>
		<comments>http://www.sharemuch.com/2010/08/30/getting-started-with-wcf-services-on-sharepoint-2010/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 05:08:36 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[listdata]]></category>
		<category><![CDATA[rest service sharepoint]]></category>
		<category><![CDATA[wcf service]]></category>
		<category><![CDATA[wfc]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1386</guid>
		<description><![CDATA[As you may know, SharePoint 2010 can host WCF services in it&#8217;s environment. There are number of benefits to using WCF over old way of using SOAP. This is going to be one of at least 2 articles I&#8217;m planning &#8230; <a href="http://www.sharemuch.com/2010/08/30/getting-started-with-wcf-services-on-sharepoint-2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<p>As you may know, SharePoint 2010 can host WCF services in it&#8217;s environment. There are number of benefits to using WCF over old way of using SOAP. This is going to be one of at least 2 articles I&#8217;m planning to talk about WCF and SharePoint.</p>
<p>In this part I will talk about how you can use <strong>ListData.svc</strong> out of the box web service in your sample application. In next post I will cover how to <a href="http://www.sharemuch.com/2010/08/31/creating-wcf-service-in-sharepoint-2010/" target="_self">create you custom WCF service and consume it through browser calls in XML or JSON</a>.</p>
<p>ListData.svc is an out-of-the-box service allowing you to list any lists available on the current web and access items within those lists using web service calls.</p>
<p>Navigate to (<em>C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI</em>) where you will find: <strong>ListData.svc. </strong>From the browser you can access this service by using relative URL: ~/_vti_bin/ListData.svc.</p>
<p>This means if you have a site collection <a href="http://localhost">http://localhost</a> &#8211; you would call <a href="http://localhost/_vti_bin/ListData.svc">http://localhost/_vti_bin/ListData.svc</a>; try and make the call. If you see XML back &#8211; that&#8217;s a good sign. If you got an error</p>
<pre>Could not load type ‘System.Data.Services.Providers.IDataServiceUpdateProvider’</pre>
<p>this means you first need to apply the following service pack: <a title="ListData.svc issue service pack" href="http://support.microsoft.com/kb/976127" target="_blank">http://support.microsoft.com/kb/976127</a>.</p>
<p>Try calling a web service and see if you get results back.</p>
<p>Now let&#8217;s try to call out list data service using JavaScript. Create a new HTM file and paste the following code in it.</p>
<pre>&lt;html&gt;
&lt;head&gt;</pre>
<pre>&lt;script src="<a href="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js">http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js</a>" type="text/javascript"&gt;&lt;/script&gt;</pre>
<pre>&lt;script type="text/javascript"&gt;</pre>
<pre>$(document).ready(function() {</pre>
<pre>    $.getJSON("<a href="http://localhost/_vti_bin/ListData.svc/Images&quot;,function(data">http://localhost/_vti_bin/ListData.svc/Calendar",function(data</a>) {</pre>
<pre>            var count = 0;             $.each(data.d.results, function(i,result)</pre>
<pre>{                 var title = result.Title;                </pre>
<pre>html = "&lt;table&gt; \                </pre>
<pre>&lt;tr&gt;&lt;td&gt;" + title +"&lt;/td&gt;&lt;/tr&gt; \                </pre>
<pre>&lt;/table&gt;";</pre>
<pre>                $('#resultarea').append($(html));
            });</pre>
<pre>     });</pre>
<pre>});</pre>
<pre>&lt;/script&gt;</pre>
<pre>&lt;/head&gt; &lt;body&gt;    &lt;div id="resultarea"&gt;    &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre>
<p>This code assumes you have a list called Calendar on your root site of your site collection. Make sure you create one and add few items into the list. The code will iterate through the list and display titles of all calendar events you have in the list.</p>
<p>This concludes our short demonstration of out-of-the-box WCF services and calling them in JS.</p>
<p>Check back tomorrow to see how you can <a href="http://www.sharemuch.com/2010/08/31/creating-wcf-service-in-sharepoint-2010/" target="_self">create your own SharePoint hosted REST services</a>.</p>
<p>Good Luck!</p>

<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/KYL2NNd2CEw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/30/getting-started-with-wcf-services-on-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/08/30/getting-started-with-wcf-services-on-sharepoint-2010/</feedburner:origLink></item>
		<item>
		<title>Have SharePoint public site – here is how to make it mobile friendly</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/mNXNmuHe8h8/</link>
		<comments>http://www.sharemuch.com/2010/08/27/have-sharepoint-public-site-here-is-how-to-make-mobile-friendly/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 03:00:44 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[sharepoint mobile]]></category>
		<category><![CDATA[sharepoint mobile redirect]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1374</guid>
		<description><![CDATA[SharePoint, especially 2010 release, is becoming more popular as a public site platform &#8211; and with an increased number of mobile devices &#8211; mobile site experience is expected. Both SharePoint and SharePoint 2010 have mobile support. When user with a &#8230; <a href="http://www.sharemuch.com/2010/08/27/have-sharepoint-public-site-here-is-how-to-make-mobile-friendly/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<p>SharePoint, especially 2010 release, is becoming more popular as a public site platform &#8211; and with an increased number of mobile devices &#8211; mobile site experience is expected.</p>
<p>Both SharePoint and SharePoint 2010 have mobile support. When user with a mobile device accesses the site &#8211; the site redirects users to a mobile version of the site. In this article we will cover how to make sure that you redirect all of the latest devices to a mobile site as well as how the actual redirect happens.</p>
<p>If you Navigate to the root of your SharePoint site in IIS (Ex. C:\Inetpub\wwwroot\wss\VirtualDirectories\80) you will locate <strong>App_Browsers</strong> &#8211; the folder that contains browser definitions. In order to ensure you have support for all of the latest browsers &#8211; you can download the latest browser definition file (mobile.browser) from codeplex &#8211; <a href="http://mdbf.codeplex.com" target="_self">Mobile Device Browser File</a> (credit goes to Mark Bice for this one) .</p>
<p>Now copy the <strong>mobile.browser </strong>file you downloaded to <strong>Devices</strong> folder in <strong>App_Browsers</strong> which you will have to create.</p>
<p>If you worked with ASP.Net before you probably know that <strong>HttpContext </strong>has a property that will determine whether your browser is a mobile browser &#8211; <strong>HttpContext.Current.Request.Browser.IsMobileDevice </strong>. This will ordinarily return false unless you have an up to date mobile.browser file &#8211; so keep your browser definitions current.</p>
<p>What happens next is really up to you. You can create a user control in the masterpage of your SharePoint site; the user control will have a code behind that will determine whether the current browser is a mobile device browser and redirect users to more simplified version of a site.</p>
<p>Here is how my user control code behind could look like:</p>
<pre>HttpRequest req = HttpContext.Current.Request;</pre>
<pre>string pageName = req.Url.Segments[req.Url.Segments.Length - 1];</pre>
<pre>string mobileUrl = MobileHelper.getMobilePage(pageName);</pre>
<pre>if (HttpContext.Current.Request.Browser.IsMobileDevice)</pre>
<pre>{   if (!string.IsNullOrEmpty(mobileUrl))</pre>
<pre>{        Response.Redirect("~/Mobile/Pages/" + mobileUrl);    }</pre>
<pre>else    {        Response.Redirect("~/Mobile/Pages/" +</pre>
<pre>MobileConstants.NotFoundPage);    }   }</pre>
<p>Good Luck!</p>

<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/mNXNmuHe8h8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/27/have-sharepoint-public-site-here-is-how-to-make-mobile-friendly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/08/27/have-sharepoint-public-site-here-is-how-to-make-mobile-friendly/</feedburner:origLink></item>
		<item>
		<title>Automated SharePoint 2010 install/upgrade using PowerShell</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/xaMEUrXmRyA/</link>
		<comments>http://www.sharemuch.com/2010/08/25/automated-sharepoint-2010-installupgrade-using-powershell/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 19:33:19 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[sharepoint 2010 upgrade]]></category>
		<category><![CDATA[sharepoint deployment]]></category>
		<category><![CDATA[sharepoint installation]]></category>
		<category><![CDATA[sharepoint upgrade]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1370</guid>
		<description><![CDATA[When you develop with SharePoint you often have to set up development, build, qa environments, but wait &#8211; there is also production etc. All that takes time and SharePoint 2010 really stepped up in how you can quickly automate building of &#8230; <a href="http://www.sharemuch.com/2010/08/25/automated-sharepoint-2010-installupgrade-using-powershell/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<p>When you develop with SharePoint you often have to set up development, build, qa environments, but wait &#8211; there is also production etc. All that takes time and SharePoint 2010 really stepped up in how you can quickly automate building of your environment.</p>
<p>You can start with abase machine installation: Windows, SQL etc. When you&#8217;re happy with configuration and and VM is all good to go &#8211; you can use the following steps to set up your SharePoint.</p>
<p>1. Copy SharePoint 2010 installation files to any directory accessible from your computer<br />
(in my case: \Desktop\Sp2010Install)<br />
2. Open the following file in the copied installation file structure:<br />
<strong>Desktop\Sp2010Install\Files\SetupSilent\config.xml</strong>.<br />
4. The contents will look like this:</p>
<p>&lt;Configuration&gt;<br />
 &lt;Package Id=&#8221;sts&#8221;&gt;<br />
  &lt;Setting Id=&#8221;LAUNCHEDFROMSETUPSTS&#8221; Value=&#8221;Yes&#8221;/&gt;<br />
 &lt;/Package&gt;</p>
<p> &lt;Package Id=&#8221;spswfe&#8221;&gt;<br />
  &lt;Setting Id=&#8221;SETUPCALLED&#8221; Value=&#8221;1&#8243;/&gt;<br />
 &lt;/Package&gt;</p>
<p> &lt;Logging Type=&#8221;verbose&#8221; Path=&#8221;%temp%&#8221; Template=&#8221;SharePoint Server Setup(*).log&#8221;/&gt;<br />
 &lt;PIDKEY Value=&#8221;Enter product key&#8221; /&gt;<br />
 &lt;Display Level=&#8221;none&#8221; CompletionNotice=&#8221;no&#8221; /&gt;<br />
 &lt;Setting Id=&#8221;SERVERROLE&#8221; Value=&#8221;SINGLESERVER&#8221;/&gt;<br />
 &lt;Setting Id=&#8221;USINGUIINSTALLMODE&#8221; Value=&#8221;0&#8243;/&gt;<br />
 &lt;Setting Id=&#8221;SETUP_REBOOT&#8221; Value=&#8221;Never&#8221; /&gt;<br />
 &lt;Setting Id=&#8221;SETUPTYPE&#8221; Value=&#8221;CLEAN_INSTALL&#8221;/&gt;<br />
&lt;/Configuration&gt;<br />
Here we have the value of the product key.</p>
<p>Also, we changed the value of <strong>SETUPTYPE</strong> to <strong>CLEAN_INSTALL</strong> to perform a clean install. If this is an upgrade  &#8211; use <strong>V2V_INPLACE_UPGRADE</strong><br />
For more options available &#8211; check out <strong>config.xml </strong>reference (SharePoint Foundation 2010) at TechNet:<br />
<a href="http://technet.microsoft.com/en-us/library/cc287749.aspx">http://technet.microsoft.com/en-us/library/cc287749.aspx</a></p>
<p>5. Now create new file in the parent directory of your SP 2010 installation files folder called <strong>simplefarm.ps1</strong><br />
Replace the contents of the file with contents of the file as described on Technet (<a href="http://technet.microsoft.com/en-us/library/ee805951.aspx" target="_self">Quick start: Deploy single server in an isolated Hyper-V environment (SharePoint Server 2010)</a>):</p>
<p>6. Replace the settings section values on the top of the <strong>simplefarm.ps1 </strong>file with the something that will match your silent install scenario, if you leave those as is &#8211; you will be prompted for installation parameters. In my case the info is as follows.</p>
<pre>## This is the folder where installation files are
$SetupPath         = "C:\Users\MyUsername\Desktop\Sp2010Install"
## This command will prompt for the username and password
$FarmCredential    = Get-Credential "mydomain\yar";
## Database server name - we assume you already have this set up
$DBServer          = "mydbservername"
## This is optional parameter - a farm name
$FarmName          = "SP2010"
## This is also optional parameter - the port of the central admin site
$CAPort            = "1111"</pre>
<p>7. Run the <strong>simplefarm.ps1</strong> file by right clicking and selecting <strong>Run with PowerShell</strong>.</p>
<p>8. If you get a OWSTIMER crash error &#8211; just click NO to debug option and your setup will continue.</p>
<p><a href="http://www.sharemuch.com/wp-content/uploads/2010/08/timercrashed.png"><img class="alignnone size-full wp-image-1371" title="timercrashed" src="http://www.sharemuch.com/wp-content/uploads/2010/08/timercrashed.png" alt="" width="398" height="427" /></a></p>
<p>Good Luck!</p>

<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/xaMEUrXmRyA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/25/automated-sharepoint-2010-installupgrade-using-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/08/25/automated-sharepoint-2010-installupgrade-using-powershell/</feedburner:origLink></item>
	</channel>
</rss>
