Tuesday, November 1, 2011

Creating a Wiki Page template For SharePoint 2010 Foundation

style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">Introduction


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">As
I have ever written several time in my previous posts, one of the severe
limitation of SharePoint Foundation is that the Wiki Pages are based on a single
template wkpstd.aspx located at


C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\14\TEMPLATE\DocumentTemplates


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">If
you try to add a wiki page programmatically to a wiki page library of
a SharePoint Foundation team site and you want it to be ghosted you must
use the method SPFileCollection.Add with this signature :


 href="http://msdn.microsoft.com/en-us/library/aa543347.aspx">color=#0033cc>Add(String, SPTemplateFileType)


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">And
pass the reference of the wiki page template wkpstd.aspx to the SPTemplate
parameter. If you use any other signature, you will be able to add a wikipage, but
it will be unghosted.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">I
am now going to show you a very amazing workaround to use another template than
the wkpstd.aspx one and will process in  two steps. First I will
demonstrate it so as you can easily understand its principle then I will provide
a programmatic way of doing it.


style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">Demonstration


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Start
creating your new template by duplicating the wkpstd.aspx and rename it
wkpcustom.aspx, then perform a little operation of customization in order each
page based on this new template can tell its name :


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">In
the page directive section add the namespace System.Diagnostics because the wiki
pages will tell their nam in the debugView...


<%size=2>@ color=#a31515 size=2>Import color=#ff0000 size=2>Namespacecolor=#0000ff size=2>size=2>="System.Diagnostics" %>


Then, at the top of the PlaceHolderMain section paste this code:

size=2>

size=2>protected size=2>override
size=2>void OnPreInit(size=2>EventArgs
e)
{
size=2>     basesize=2>.OnPreInit(e);

color=#2b91af size=2>    Debugsize=2>.WriteLine(size=2>SPContextsize=2>.Current.File.Name);
}


 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Then,
we are going to prepare a feature to reference this wkpcustom.aspx file in a
SharePoint Foundation wiki page library.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Assume
we call the feature


 Provisioning.SPF_WikiPages


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Here
is the feature.xml code:


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><?
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>xml
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>
style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>version
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"1.0"
encodingstyle="COLOR: blue">="utf-8"style="COLOR: blue">?>"urn:schemas-microsoft-com:office:office" />


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Feature
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>
style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Id
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"style="COLOR: blue">00BFEA71-2062-426C-90BF-714C59600AAA"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Title
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"Adding pre populate wiki
pages
"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Description
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"This feature will add pre-populate wiki
pages to the site pages wiki library of this site
"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Version
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"1.0.0.0"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Scope
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"Web"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Hidden
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"false"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>DefaultResourceFile
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"core"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>xmlns
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"style="COLOR: blue">http://schemas.microsoft.com/sharepoint/"style="COLOR: blue">>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">ElementManifestsstyle="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">style="mso-spacerun: yes">    <style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">ElementManifeststyle="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">
style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">Locationstyle="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"style="COLOR: blue">elements.xml"
/>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">style="mso-spacerun: yes">  </style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">ElementManifestsstyle="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">>


style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"></style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">Featurestyle="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">>


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">And
this is the xml code of the elements.xml file


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Elements
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>
style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>xmlns
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"style="COLOR: blue">http://schemas.microsoft.com/sharepoint/color=#000000>"style="COLOR: blue">>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>  <
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Module
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>
style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Url
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"style="COLOR: blue">SitePages"style="COLOR: blue"> >


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>   
<
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>File
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>
style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Url
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>=
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>"style="COLOR: blue">wkpcustom.aspx"style="COLOR: blue"> Typestyle="COLOR: blue">="style="COLOR: blue">GhostableInLibrary"style="COLOR: blue">></style="COLOR: #a31515">Filestyle="COLOR: blue">>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"></style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">Modulestyle="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"></style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">Elementsstyle="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">>


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">color=#000000 size=3 face="Times New Roman"> 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Last,
a screen shot of the Provisioning.SPF_WikiPages feature folder








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Then,
install the feature and activate it for one of the team site of your Farm and
you will have a reference to your page in the site pages library of this team
site.









 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">You
can see a reference to the wkpcustom file located in the feature folder on the
server









 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">And
because this file was provisioned by a feature, although there is in line code
in it, if you display the wiki page using this file, it will work, the code
will run and will write the name of the page in the debugview.








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">But,
wait a minute, this file is already a template. It is a template for just one
page within the site pages library but it is exactly like the wkpstd.aspx for
the other pages. So assume we could have several pages within the library based
on this file we would have created a new template. I see some of you
smiling...


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">You
have understood... It is what we are going to do now...


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Now
is the time to use another workaround I have already shown in a previous post to
open our library in explorer mode.
So switch to shared documents library,
open it in explorer mode, then using the explorer folder navigation go back to
the site pages library but in explorer mode now








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Then
rename the page in "page 01.aspx"








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">then
go back to the site pages library within the SharePoint UI. You will notice that
the page is renamed and if you displayed it, its name in the debugview has
changed too. While renamed, the page remains in its ghosted state and linked
to the "template".








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Now
deactivate the feature, then reactivate it and you will have a new page
wkpcustom.aspx beside the "page 01.aspx" and the two pages are linked to the
same file on the server, so if we display one then the other, debugview will
trace the two names based on the code of an unique file on the server: we have
created our first custom template for a wiki page library in SharePoint
Foundation!








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Now
we have done the demonstration we just have to find the way to do it
programmatically:


style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">Coding
the sequence


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">this
applicative page called from your site will provision 9 pages in your site
page library pointing on the same unique template wkpcustom.aspx located in the
feature folder. If you modify the file in the folder, you will modify the 9
pages


 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-no-proof: yes; mso-highlight: yellow"><%style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">@style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> style="COLOR: #a31515">Page Languagestyle="COLOR: blue">="C#" style="COLOR: red">AutoEventWireupstyle="COLOR: blue">="true" Inheritsstyle="COLOR: blue">="Microsoft.SharePoint.WebControls.LayoutsPageBase"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">style="mso-spacerun: yes">    style="COLOR: red">DynamicMasterPageFilestyle="COLOR: blue">="~masterurl/default.master" style="BACKGROUND: yellow; mso-highlight: yellow">%>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-no-proof: yes; mso-highlight: yellow"> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes; mso-highlight: yellow"
lang=EN-US><%
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>@
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> Assembly style="COLOR: red">Name="System.Core,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
style="BACKGROUND: yellow; mso-highlight: yellow">%>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes; mso-highlight: yellow"
lang=EN-US><%
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>@
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> Import style="COLOR: red">Namespacestyle="COLOR: blue">="Microsoft.SharePoint" style="BACKGROUND: yellow; mso-highlight: yellow">%>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes; mso-highlight: yellow"
lang=EN-US><%
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>@
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> Import style="COLOR: red">Namespacestyle="COLOR: blue">="Microsoft.SharePoint.Administration" style="BACKGROUND: yellow; mso-highlight: yellow">%>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes; mso-highlight: yellow"
lang=EN-US><%
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>@
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> Import style="COLOR: red">Namespacestyle="COLOR: blue">="System.Text" style="BACKGROUND: yellow; mso-highlight: yellow">%>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes; mso-highlight: yellow"
lang=EN-US><%
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>@
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> Import style="COLOR: red">Namespacestyle="COLOR: blue">="System.Linq" style="BACKGROUND: yellow; mso-highlight: yellow">%>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes; mso-highlight: yellow"
lang=EN-US><%
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>@
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> Assembly style="COLOR: red">Name="Microsoft.SharePoint,
Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
style="BACKGROUND: yellow; mso-highlight: yellow">%>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="BACKGROUND: yellow; mso-highlight: yellow">
 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>asp
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>:
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>content
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> idstyle="COLOR: blue">="PageHead" style="COLOR: red">contentplaceholderidstyle="COLOR: blue">="PlaceHolderAdditionalPageHead" style="COLOR: red">runatstyle="COLOR: blue">="server">


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US></
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>asp
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>:
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>content
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>asp
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>:
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>content
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> idstyle="COLOR: blue">="Main" style="COLOR: red">contentplaceholderidstyle="COLOR: blue">="PlaceHolderMain" style="COLOR: red">runatstyle="COLOR: blue">="server">


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>script
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> languagestyle="COLOR: blue">="C#" runatstyle="COLOR: blue">="server">


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>    style="COLOR: blue">protected override
void OnLoad(style="COLOR: #2b91af">EventArgs e)


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>   
{


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">       
base.OnLoad(e);


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">       
SPWeb myWeb = SPContext.Current.Web;


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">       
myWeb.AllowUnsafeUpdates = style="COLOR: blue">true;


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">       
for (style="COLOR: blue">int i = 1; i < 10; i++)


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">       
{


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
if (myWeb.Features[style="COLOR: blue">new Guid(style="COLOR: #a31515">"{00BFEA71-2062-426C-90BF-714C59600AAA}")] !=
null)


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
{


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">              
 myWeb.Features.Remove(style="COLOR: blue">new Guid(style="COLOR: #a31515">"{00BFEA71-2062-426C-90BF-714C59600AAA}"));


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
}


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
myWeb.Features.Add(new style="COLOR: #2b91af">Guid(style="COLOR: #a31515">"{00BFEA71-2062-426C-90BF-714C59600AAA}"));


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
SPList myList = myWeb.Lists["Site
Pages"
];


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
SPListItem myItem = style="COLOR: blue">null;


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
SPContext.Current.Web.AllowUnsafeUpdates = style="COLOR: blue">true;


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
foreach (SPListItem anItem style="COLOR: blue">in myList.Items)


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
{


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">               
if (anItem.Name == style="COLOR: #a31515">"wkpcustom.aspx")


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">               
{


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">                   
myItem = anItem;


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">               
}


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
}


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
string destinationUrl = myWeb.Url +
"/" + myList.RootFolder.Url + style="COLOR: #a31515">"/" + style="COLOR: #a31515">"Wiki_page0" + i + style="COLOR: #a31515">".aspx";


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
myItem.File.MoveTo(destinationUrl);


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
myItem.File.Update();


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">           
myWeb.Features.Remove(new style="COLOR: #2b91af">Guid(style="COLOR: #a31515">"{00BFEA71-2062-426C-90BF-714C59600AAA}"));


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">       
}


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>style="mso-spacerun: yes">       
lbl1.Text = "Your files has been
provisionned successfully..."
;


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>   
}


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US></
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>script
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>asp
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>:
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Label
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> runatstyle="COLOR: blue">="server" IDstyle="COLOR: blue">="lbl1" style="COLOR: blue">></aspstyle="COLOR: blue">:Labelstyle="COLOR: blue">>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US></
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>asp
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>:
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>content
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>asp
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>:
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>content
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> idstyle="COLOR: blue">="PageTitle" style="COLOR: red">contentplaceholderidstyle="COLOR: blue">="PlaceHolderPageTitle" style="COLOR: red">runatstyle="COLOR: blue">="server">


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Provisioning Team Site Wiki Pages


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US></
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>asp
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>:
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>content
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>>


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US><
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>asp
style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>:
style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>content
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> idstyle="COLOR: blue">="PageTitleInTitleArea" style="COLOR: red">contentplaceholderidstyle="COLOR: blue">="PlaceHolderPageTitleInTitleArea"


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>    style="COLOR: red">runatstyle="COLOR: blue">="server">


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US>Provisioning Team Site Wiki Pages


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-ansi-language: EN-US; mso-no-proof: yes"
lang=EN-US> 


class=MsoNormal>style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"></style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">aspstyle="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">:style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">contentstyle="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">>


face=Calibri> 



 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Here
are the screen shots of the applicative page after its provisioning job is
finished








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">and
the site pages library with the 9 new pages








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">And
if I call the 9 pages, each of them will tell me its name.








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">And
now, I have changed the instruction of the name displaying in the template, and I
have called back the 9 pages and here is the result.








 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Have
a lot of fun with that!


 

Sunday, October 23, 2011

Configuring SharePoint 2010 Foundation for Internet-facing publishing

style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">Introduction


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">I
am starting a set of posts regarding the ability of SharePoint 2010 foundation
to be used to build Internet-facing web sites. In this one we are just going to
perform configuration and creation operations so as we can obtain a SharePoint
Foundation site collection that can be used to publish content on the Internet
and therefore, available for anonymous users.


style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">Business
benefits - The "why" part of the post

style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">In
SharePoint 2007 the Internet-facing publishing was rather based on the use of
the publishing part of SharePoint, its CMS.

However, the team sites that
were a part of the collaboration area of SharePoint 2007 are now with the new
wiki pages of SharePoint 2010 a way to help people to publish formal content.
The team sites are now described in the SharePoint 2010 documentation as a
solution to encourage one-to-many communication and also a solution to offer a
structured exchange of information.

Therefore the team sites of
SharePoint Foundation are now mature enough to be used as a base to build
Internet-facing web sites and are a new and more cost effective opportunity
offered by SharePoint 2010 to publish content on the Internet. The free
SharePoint Foundation team sites can be now seen as a severe competitor to the
licensed SharePoint CMS!


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">For
further information, see the Microsoft documentation:


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">href="http://msdn.microsoft.com/en-us/library/ee721051.aspx#section1">Comparison
of Enterprise Wikis with Team Sites


href="http://technet.microsoft.com/en-us/library/cc288638.aspx#Section2c">Plan
Internet presence sites
(SharePoint 2010 Foundation)


And this
Ted Pattison's video:

href="http://msdn.microsoft.com/en-us/SP2010DevTrainingCourse_SitesasCollectionsofPages.aspx">Sites
as Collections of Pages

(See how Sites in SharePoint 2010 just become a
collection of pages. Unlike before pages now play a key role in the structure of
a site... )


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">

I have just found
elements of comparison when considering SharePoint Server 2010 Publishing Sites
vs. SharePoint Foundation 2010 Sites:

SharePoint Server 2010 Publishing
Sites vs. SharePoint Foundation 2010 Sites

After requirements gathering
is complete, first decide whether to base the website on Microsoft SharePoint
Foundation 2010, or on a server running Microsoft SharePoint Server 2010 with
the Publishing Features enabled. Publishing sites are built on SharePoint
Foundation, and there are many advantages to building engaging Internet-facing
websites with publishing sites. Some of the benefits of creating a brand with
SharePoint Server publishing sites and SharePoint Foundation sites include the
following:

Enables content authors to create webpages with a more robust
rich-text editing experience than SharePoint Foundation sites offer.


Includes master pages that target publishing sites and that use specific
code assemblies that take advantage of publishing Features.

Easier
control of web navigation from the web UI, and more options are available to the
designer.

Uses the Web UI to easily change a master page and to apply
master pages to all subsites below the current site.

Uses page layouts
to create templates at the page level. Uses text layouts to accomplish a form of
simple page layout. Text layouts are not configurable.

Use the $SPUrl
token to target HTML assets with URLs that are relative to either the site
collection ($SPUrl;~sitecollection/) or site root ($SPUrl:~site/)


source: href="http://msdn.microsoft.com/en-us/library/gg430141.aspx">Real World Branding
with SharePoint 2010 Publishing Sites


style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">Audience


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">I
will avoid using development operations in this first post in order it can be
useful to system administrators. Of course it is also targetted for developers
so as they can configure their development machine, but they won't have to
launch Visual Studio here.


style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">1
- Extending an existing SharePoint Foundation Web Application

style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Assume
you have created a SharePoint Foundation web application using NTLM
authentication (that is the default mode).
Go to the SharePoint 2010 Central
Administration of your SharePoint Farm, click the "Manage web applications" link
then on the displayed list of the available
web application select the one you want to open to anonymous users.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">The
buttons of the SharePoint 2010 ribbon are now  usable, so click on
Extend.
The Extend pop-up appears.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Type
the name of the new web application
Type 80 for port
Define a host
header
Select Allow Anonymous because we are planning anonymous access
For
the zone, choose Internet, because we plan to extend the existing web
application for an Internet access.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">So
as you will obtain the following screen shots


href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcHIs9uXTiGWQggVXSRrNurgGF8h6jM6Jn3PdI24fN_KU30TYd7EZJDdNwWuM-cHTapr4HT23eimWIwd7pZk_bt-5DtBNjQcESQr5MqifrE6hWRt-11KyYCv_Hi3IILtHq8sOicNhDJM9P/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+010+-+Extending+the+web+application+1.jpg">style="WIDTH: 320px; HEIGHT: 154px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666739129036206162 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcHIs9uXTiGWQggVXSRrNurgGF8h6jM6Jn3PdI24fN_KU30TYd7EZJDdNwWuM-cHTapr4HT23eimWIwd7pZk_bt-5DtBNjQcESQr5MqifrE6hWRt-11KyYCv_Hi3IILtHq8sOicNhDJM9P/s320/configuring+sharepoint+foundation+for+Internet+facing+-+010+-+Extending+the+web+application+1.jpg">


 


href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-gR36Wzww-sfCBYVoXT2rpwg_qWFFFHhz6X0BbQyRQT-qezoaQYnnTCVjduHSjHauIGhan-_trAeuvXF6oeKEUukmgPxLd7sk3Wkbj93tCydKUsjRRYhH5UPNCyCvyaErCsU5Ll3Arcx8/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+020+-+Extending+the+web+application+2.jpg">style="WIDTH: 320px; HEIGHT: 154px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666739124739848914 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-gR36Wzww-sfCBYVoXT2rpwg_qWFFFHhz6X0BbQyRQT-qezoaQYnnTCVjduHSjHauIGhan-_trAeuvXF6oeKEUukmgPxLd7sk3Wkbj93tCydKUsjRRYhH5UPNCyCvyaErCsU5Ll3Arcx8/s320/configuring+sharepoint+foundation+for+Internet+facing+-+020+-+Extending+the+web+application+2.jpg">


 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Then,
 click the "OK" button to create the web application.
Nothing has
changed in the web application list, but if you navigate to the Alternate Access
Mappings page of the central administration (in the System Settings
section), then click on the "Edit Public Zone URLs" link and select the
extended web application you will notice taht the zone was properly created.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px"> 


href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi569XQ9PYPNbDMuz0n2la04gPD9qiGL2cLTpVx0lPoPEHUvigaopNnUKHFq1gGATo9koCn14ANty_ikT2XT5lnK0zG4z7a-Me136P4Ed8ihwhd6zWsAmoOTniQV87a8C-YgF4lnwFcy9zf/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+030+-+alternate+access+mapping+_+edit+zone+ursl+_+Internet+zone+created.jpg">style="WIDTH: 320px; HEIGHT: 212px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666739114760204386 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi569XQ9PYPNbDMuz0n2la04gPD9qiGL2cLTpVx0lPoPEHUvigaopNnUKHFq1gGATo9koCn14ANty_ikT2XT5lnK0zG4z7a-Me136P4Ed8ihwhd6zWsAmoOTniQV87a8C-YgF4lnwFcy9zf/s320/configuring+sharepoint+foundation+for+Internet+facing+-+030+-+alternate+access+mapping+_+edit+zone+ursl+_+Internet+zone+created.jpg">


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px"> 


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">You
can also check in IIS7 that the IIS web site for the Internet zone is now
available


href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEyoZpVUi3IsHwcsRNTKlFvM2omUdSMKDLhBAA-02WwP2IwqA_vwmgCpYT2UOsC1t5-7uYLbRwC8bZ82_mcyduhude-m9MH_byXIG6DNHAfKP4NGNUGkgTzn7bsVjMXPU9W5bCgqdtgcI5/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+040+-+IIS7+_++Internet+zone+IIS+web+site+created.jpg">style="WIDTH: 320px; HEIGHT: 151px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666739108514598754 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEyoZpVUi3IsHwcsRNTKlFvM2omUdSMKDLhBAA-02WwP2IwqA_vwmgCpYT2UOsC1t5-7uYLbRwC8bZ82_mcyduhude-m9MH_byXIG6DNHAfKP4NGNUGkgTzn7bsVjMXPU9W5bCgqdtgcI5/s320/configuring+sharepoint+foundation+for+Internet+facing+-+040+-+IIS7+_++Internet+zone+IIS+web+site+created.jpg">


style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">2 -
Testing the anonymous acces


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">As
we have defined previously a custom host header for our Internet site we have to
modify the host file of our development machine in order to be able to acces the
site as an anonymous user.
So open the hosts file of your machine located at
:


C:\Windows\System32\drivers\etc


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">and
add the following entry:


 127.0.0.1       www.mycompany.com


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Now
open a browser and browse to this url. You access your SharePoint team site as
an anonymous user and simulate an Internet acces.


href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_FIbyIUe_Ya4EIyCTrWoppPaOt-NIrxzhutHgIH0A4NaexbWfCcnmiNhi33hWrzR7dILJC2gxsyHFNKOeIhG6tBSHYDX_RFSh7OhB9dtL0ZEXoQ_o_k0_TEhuBbOA2nriKD0TEhizC5-y/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+050+-++accessing+sharepoint+foundation+team+site+through+the+Internet.jpg">style="WIDTH: 320px; HEIGHT: 152px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666761106370893106 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_FIbyIUe_Ya4EIyCTrWoppPaOt-NIrxzhutHgIH0A4NaexbWfCcnmiNhi33hWrzR7dILJC2gxsyHFNKOeIhG6tBSHYDX_RFSh7OhB9dtL0ZEXoQ_o_k0_TEhuBbOA2nriKD0TEhizC5-y/s320/configuring+sharepoint+foundation+for+Internet+facing+-+050+-++accessing+sharepoint+foundation+team+site+through+the+Internet.jpg">


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">if
you cannot access to the site with an anonymous access, browse to the
http://www.mycompany.com/_layouts/setanon.aspx page, you will be prompted for
authentication, use the site coll administrator to authenticate in NTLM mode,
switch anonymous access to Entire site, click OK (in the screen shot, url is
wrong, sorry).


 href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTpoOLert4dH_a_pT0jYh_PrdkC2tHzxSGp3ny_QNygpsnpkRrFUDMN-0kaO6ZhS7qQt5RU59gIQjRqfy4zWqnbIRcxsz3nc8Hi3woqQVMNlYbx-dxijHO1ZAl8e9jgr0xG_vYjMrNMVBc/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+060+-++disabling+reenabling+anonymous+access.jpg">style="WIDTH: 320px; HEIGHT: 157px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666827519415665938 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTpoOLert4dH_a_pT0jYh_PrdkC2tHzxSGp3ny_QNygpsnpkRrFUDMN-0kaO6ZhS7qQt5RU59gIQjRqfy4zWqnbIRcxsz3nc8Hi3woqQVMNlYbx-dxijHO1ZAl8e9jgr0xG_vYjMrNMVBc/s320/configuring+sharepoint+foundation+for+Internet+facing+-+060+-++disabling+reenabling+anonymous+access.jpg">


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">If
you select Lists and libraries, anonymous users will be able to view items only
for those lists and libraries that have enabled permissions for anonymous users.


href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNi8EWXSkQiA10_Wak20FUZ3Zxdx1aZDdQ-kowozX_kX6tImyL3zakryWGWbUE4uoq-41igkZaUhSwQogZf0cMwkJAb3Hsvp_YLNC-xjefzWcSc_RH3BdsztBmY516TJSJLPFfZnXtHM24/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+061+-++giving+specific+permissions+to+anonymous+access.jpg">style="WIDTH: 320px; HEIGHT: 202px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666868492816238834 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNi8EWXSkQiA10_Wak20FUZ3Zxdx1aZDdQ-kowozX_kX6tImyL3zakryWGWbUE4uoq-41igkZaUhSwQogZf0cMwkJAb3Hsvp_YLNC-xjefzWcSc_RH3BdsztBmY516TJSJLPFfZnXtHM24/s320/configuring+sharepoint+foundation+for+Internet+facing+-+061+-++giving+specific+permissions+to+anonymous+access.jpg">


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">However
how interesting this option is, it will force administrator to break inheritance
for each lists for those they want to grant access for anonymous
users. You will also notice that for those lists, the SharePoint Forms pages are
also accessible to anonymous users. For example, if you grant access to
anonymous users for the site pages library of a Foundation team site, anonymous
users might be able to get to http://www.mycompany.com/SitePages/Forms/AllPages.aspx.

Typically
you don't want this, so how do you prevent anonymous users from accessing these
pages?   
In SharePoint Server, where the publishing features
are available we would activate the lockdown feature especially
provided by Microsoft for avoiding this problem.  


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">By
the way, It is amazing to think to activate
within SharePoint Foundation the lockdown feature which was formerly
reserved to the SharePoint CMS .
Yes and no.
Now the team sites must be
seen as a collection of pages. They get closer to the SharePoint CMS a lot.

On this subject you should watch the href="http://msdn.microsoft.com/en-us/SP2010DevTrainingCourse_SitesasCollectionsofPages.aspx">Ted
Pattison's video
(See how Sites in SharePoint 2010 just become a collection
of pages. Unlike before pages now play a key role in the structure of a site.).






style="COLOR: red">Updated 2011 october 26th




style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">3 -
An alternative to the lockdown Feature


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Unfortunately,
this feature is not available for SharePoint foundation. So I made an adaptation
for WSS 3.0 and SharePoint Foudation 2010 that you can download as a SharePoint
solution (.wsp) on Codeplex:


Custom lockdown feature for wss
3.0 and SharePoint 2010 Foundation


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">If
you want to use it, download the .wsp and deploy it. It will be globally
deployed anyway because the feature handler .dll will be placed in the
GAC.
Then you should not need to install the feature because it will be
automatically installed at deployment time, but if the automatic
 installation had failled, you could install it by excuting this within a
command prompt:


stsadm -o installfeature -name viewformpageslockdowncustom


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">then
activate the feature for your site collection with this other instruction:


stsadm -o activatefeature -name viewformpageslockdowncustom -url
http://www.mycompany.com


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">But,
beacause we already have anonymous access enabled, we need to go disable
it, then enable it again. Go to the _layouts/setanon.aspx page, switch anonymous
access off, click OK, then go back and set it to entire site, then click OK.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Anonymous
users should now get an authentication prompt when they try to navigate to a
forms page. For example, http://www.mycompany.com/SitePages/Forms/AllPages.aspx.


href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGUa4uUsTMA9ggM_CJWplHNkrlFhRyJO7Y915F8kYu4Yqx-GlpJLMr3BJINcj1tr_AsxZ3lG_Me0mKZpHTeMTvWYCYwzGan1YhQJklCs_JUWAi-xtB9nh8Fgo8wYiDVK6wUWJG2sXwoz3T/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+070+-++Locdown+feature+enabled.jpg">style="WIDTH: 320px; HEIGHT: 153px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666827513434902882 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGUa4uUsTMA9ggM_CJWplHNkrlFhRyJO7Y915F8kYu4Yqx-GlpJLMr3BJINcj1tr_AsxZ3lG_Me0mKZpHTeMTvWYCYwzGan1YhQJklCs_JUWAi-xtB9nh8Fgo8wYiDVK6wUWJG2sXwoz3T/s320/configuring+sharepoint+foundation+for+Internet+facing+-+070+-++Locdown+feature+enabled.jpg">
 


 


style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">4 -
Setting custom error page for error 401 (forbidden) within Sharepoint 2010


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">(The
following section is dedicated to Sharepoint 2010 since you will not find the
following xml tags in the web.config of wss 3.0.)

Now we are going to do
an amazing thing. We are going to change the web.config file of the web
application corresponding to the Internet access so as anonymous user won't
be prompted anymore for authentication if they try to acces to an unauthorized
url but be redirected on a custom 401 error page within the site.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">So
first go to your site with at least contributor permissions by using NTLM access
and create a custom 401 error page in the site pages library of your site.
Assume we call it unauthorized so as its url will be href="http://www.mycompany.com/sitepages/unauthorized.aspx">http://www.mycompany.com/sitepages/unauthorized.aspx.
Type a meessage of access denied and save the page.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Then, open
the web.config file of the Internet zone web application and locate the handlers
end tag within the system.webSever and paste the following httpErrors
sequence.


    
</handlers>
       
<httpErrors errorMode="Custom"
existingResponse="Auto">
           
<remove statusCode="401"
/>
           
<error statusCode="401" prefixLanguageFilePath=""
path="/sitepages/unauthorized.aspx" responseMode="ExecuteURL"
/>
        </httpErrors>
color=#c0c0c0>  </system.webServer>


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px"> After
restarting your application pool by reloading a page of your site with anonymous
acces, you will notice an amazing thing: each time an anonymous user will try to
access to a non authorized ressource, instead of being prompted for an NTLM
authentification, he will be redirected to the custom 401 error page of your
site and he will still have your site navigation links available and be
able to keep browsing.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">And
the most amazing is you will have the same result while clicking the sign in
link.
So of course don't do that if you plan to use an Internet access for
contributing on your site or for administrating it...

And don't forget
that this will have an impact on the whole web application since we have
modified the web.config, so it won't be possible to obtain a different behaviour
for another site collection within this web application.


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px"> The
next screen shot show my 401 unauthorized custom error page after having clicked
the Sign in link.


href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY53yApJZC95_Mor5CIgudvS4OqNHyTcU-MXpuckO2_wrxpQzKfUI_DAIjfdoAHu5C05woO40Y1vhyphenhyphenTg644SwH7RqTjmAKrOzatLLGx-cOXFnssLmBT-L1XstgqntLqAPUsH7CkLd7Ctcy/s1600/configuring+sharepoint+foundation+for+Internet+facing+-+080+-++401+unauthorized+custom+error+page+after+having+clicked+the+sign+in+link+.jpg">style="WIDTH: 320px; HEIGHT: 205px; CURSOR: hand"
id=BLOGGER_PHOTO_ID_5666827515542953874 border=0 alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY53yApJZC95_Mor5CIgudvS4OqNHyTcU-MXpuckO2_wrxpQzKfUI_DAIjfdoAHu5C05woO40Y1vhyphenhyphenTg644SwH7RqTjmAKrOzatLLGx-cOXFnssLmBT-L1XstgqntLqAPUsH7CkLd7Ctcy/s320/configuring+sharepoint+foundation+for+Internet+facing+-+080+-++401+unauthorized+custom+error+page+after+having+clicked+the+sign+in+link+.jpg">



style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">It
is all that we can do for now by just performing configuration operations.

Of course, don't forget to modify the navigation within the SharePoint 2010
UI to hide all the links that could lead to an access denied for anonymous
users. In short, you should let only the links pointing on a subsite, a Site
Page or a specific document.


In the next post, we are going to use
Visual Studio to start customizing our site...


style="PADDING-BOTTOM: 10px; MARGIN: 1px 0px; PADDING-LEFT: 13px; PADDING-RIGHT: 0px; COLOR: #e9ab17; FONT-WEIGHT: bold; PADDING-TOP: 10px">5 -
Aknowledgements


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">Thanks
to :

href="http://www.ngpixel.com/2010/12/23/sharepoint-2010-custom-error-pages/">Nick
whose article helped me for custom errors, I have just noticed that he also
lives and works in Montreal...

href="http://blogs.msdn.com/b/ecm/archive/2007/05/12/anonymous-users-forms-pages-and-the-lockdown-feature.aspx">Tyler
Butler
of the ECM team blog who was by his publications of a big help in the
realization of my projects for the internet and who made me discover the
existence of the lockdown feature...

Ted Pattison for his href="http://msdn.microsoft.com/en-us/SP2010DevTrainingCourse_SitesasCollectionsofPages.aspx">video
which opens many new horizons regarding the use of SharePoint 2010. I will
publish more about it someday...


style="TEXT-ALIGN: justify; PADDING-BOTTOM: 18px; MARGIN: 1px 0px; PADDING-LEFT: 18px; PADDING-RIGHT: 5px; FONT-FAMILY: arial; COLOR: gray; FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 5px">