<?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>helloibm</title>
	<atom:link href="http://vspug.com/helloibm/feed/" rel="self" type="application/rss+xml" />
	<link>http://vspug.com/helloibm</link>
	<description>Just another VSPUG - Virtual SharePoint User Group weblog</description>
	<lastBuildDate>Tue, 15 Jan 2008 21:46:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Programmatically adding a SiteCollection with custom membership provider</title>
		<link>http://vspug.com/helloibm/2008/01/15/programmatically-adding-a-sitecollection-with-custom-membership-provider/</link>
		<comments>http://vspug.com/helloibm/2008/01/15/programmatically-adding-a-sitecollection-with-custom-membership-provider/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 21:46:00 +0000</pubDate>
		<dc:creator>helloibm</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[SPWebApplication.Sites.Add should be an easy function to call. Among the parameters is ownerLogin. This works a charm when your web application is configured for the default windows authentication. But in my case it was a custom membership provider. I tried several times to do it while specifying membershipprovider:ownername. BUT it continuously gives &#34;User cannot be [...]]]></description>
			<content:encoded><![CDATA[<p><b>SPWebApplication.Sites.Add </b>should be an easy function to call. Among the parameters is ownerLogin. This works a charm when your web application is configured for the default windows authentication. But in my case it was a custom membership provider. I tried several times to do it while specifying <b><i>membershipprovider:ownername</i></b>. BUT it continuously gives &quot;<b>User cannot be found</b>&quot;. </p>
<p>At the end i had to resort to the <b>Admin.asmx</b> web service. It provides us a <b>CreateSite</b> function with almost the same functionlity as the SPWebApplication.Sites.Add(). The only catch here is that this method will only work on the central admin web application. You cannot use it on any content applications. ( <b>REF: WSS SDK Admin::CreateSite</b> )</p>
<p>So here is how i ended up solving my problem</p>
<p>//Create an instance of the Central Admin web service<br />_Admin.Admin _adm = new _Admin.Admin();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;//Get the url for the Admin site.<br />string caURL = System.Configuration.ConfigurationSettings.AppSettings[&quot;centralAdminApplicationURL&quot;].ToString();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />//set the URL to the &quot;REQUIRED&quot; central admin site<br />_adm.Url = caURL + &quot;/_vti_adm/admin.asmx&quot;;</p>
<p>//Prefix the membership provider name to the ownerlogin.<br />string provider = System.Configuration.ConfigurationSettings.AppSettings[&quot;membershipProviderKey&quot;].ToString();<br />ownerLogin = provider + &quot;:&quot; + ownerLogin;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />//set the credentials for current web service call.<br />_a.Credentials = new System.Net.NetworkCredential(&quot;user&quot;, &quot;password&quot;, &quot;DOMAIN&quot;);<br />_a.CreateSite(siteCollURL, title, description, langID, template, ownerLogin, ownerName, ownerEmail, &quot;&quot;, &quot;&quot;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://vspug.com/helloibm/2008/01/15/programmatically-adding-a-sitecollection-with-custom-membership-provider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
