Speaking at SharePoint Saturday–The Conference

image

The first event of it’s kind, SharePoint Saturday – The Conference (it’s not just for Saturdays anymore! However, this will end on one…), and I am pleased to be a part of it. I’m also very excited to see that SharePoint Saturday has grown so much over the past couple of years, and now there is a full 3-day conference. SharePoint Saturdays are great ways to share your knowledge with others, learn from peers, experts, MVPs and Microsoft Certified Masters. SharePoint Saturday holds a special place for me, as that is where I got my start speaking on SharePoint, back in the beginning of 2009 at SharePoint Saturday Boston. Since then I have spoken at 11 others to date from New York to New Orleans, and have helped organize SharePoint Saturday Boston since the beginning of 2010.

Unlike usual SharePoint Saturdays however, this one is not free, but pretty close to it as far as conference fees go. The current rate is $39, which will go up to $59 soon, so if you want to save twenty bucks… register today!

I could write-up all of the information about the conference, but it has already been done on the site, so why reinvent the wheel (http://www.spstc.org/Pages/About.aspx) – the text below is a copy of that.

WHAT

A community-focused, educational event filled with sessions from respected SharePoint professionals and executives covering a wide range of technical and business topics.

WHO

Anyone who interacts with SharePoint and its related technologies: Tracks for IT Pro, Developers, End Users, Business Process Owners, the Cloud and more!

WHERE

Northern Virginia Community College

Annandale Campus, Annandale, VA

(Visit the website here.)

WHEN

Thursday, August 11 – Saturday, August 13, 2011: 8 am – 6 pm

Friday Night Attendee Event: 6 pm – 11 pm

WHY

SharePoint Saturdays are a community sponsored event with a huge following. As we take the SharePoint Saturday event to the next level, the goal remains the same: to encourage community participation and lower the barriers to learning SharePoint.

For attendees in any role (End User, IT Professional, Business Manager or Developer), this conference provides an unparalleled level of training, sharing, networking and one-to-one interaction with the SharePoint community. It’s not to be missed!

HOW

Registration Fee:

$39 Early Bird (until August 7, 2011)

$59 for Regular & Walk-Ins

(discounts available for groups of 10 or more)

And there are some FAQ’s on the conference about page as well… http://www.spstc.org/Pages/About.aspx

I will be presenting 3 sessions there, so please drop in to one and say hello if you go!

 

9 Ways to Become a (SharePoint) Rock Star

Co-Presented with Christian Buckley

Session Level: 100

Session Type: End User

So you want to become a rock star? We’re talking actual rock star – not a metaphor for “finding stardom” at your company, but that little “band thing” you do on the side after putting in your 9-to-5 each day.
In this session, we will lead you on a fun and adventurous journey where you can not only learn SharePoint, but springboard into that life of fame and rock stardom that you’ve been dreaming of, using the tools at your disposal during the daily grind. If, by chance, your wildest dreams of becoming a rock star do not come to fruition, you can be rest assured that you can apply what you learn in this session to become a SharePoint rock star. Because its always good to have a backup plan.

 

Just Freakin’ Work! Overcoming Hurdles and Avoiding Pain in SharePoint Custom Development

Co-Presented with Mark Rackley

Session Level: 200

Session Type: IT Pro / Developer

“Why am I getting a security error??” “Why does my code work sometimes, but not others?” “I wonder if McDonalds is hiring.” Writing custom code in SharePoint opens up unlimited possibilities but also throws many hurdles in your way that will slow you down if you don’t take them into account. So, before giving up and searching for careers in the fast food industry, equip yourself with the knowledge you need to succeed in writing custom code for SharePoint.
Attendees will learn:
1. Commonly used methods to improve functionality and performance
2. Best practices for disposing of SP Objects
3. How to avoid common issues when writing custom code for SharePoint
PREREQUISITES: Developers need to have a basic knowledge of SharePoint, know C# and be comfortable in Visual Studio.

 

Planning and Configuring Extranets in SharePoint 2010

Session Level: 300

Session Type: IT Pro / Admin

Most companies, large or small, require contact and collaboration with external entities, whether they are vendors, clients, or contractors. SharePoint gives us the ability to open up portals for collaboration with these external entities – this session will show you how to accomplish this using SharePoint 2010.
We will review what is required to make SharePoint “open” to the external world, discuss scenarios regarding security and privacy, as well as walk through configuring Forms Based Authentication, Claims Based Authentication, as well as using Business Connectivity Services in SharePoint 2010, to authenticate, and manage our external users.
Once completing this session, you should have a firm grasp on how to configure an extranet environment using SharePoint 2010, as well as what should be considered during the planning of your extranet scenarios.

Imtech Content Query Web Part for SharePoint 2010

If you are running a publishing site in SharePoint, then you know the name Waldek Mastykarz. If you don’t, you should. His blog is filled with many posts on SEO, Content Query Web Parts, and much more. I had a client request to add some paging into the Content Query Web Part, and stumbled upon Waldek’s Imtech Content Query Web Part for SharePoint 2010. This was the perfect solution for my client, but I needed to make a few modifications… this post will go over the modifications and issues we encountered and resolved.

The Issues and Modifications

  • My client had many customized item styles they still wanted to use, so using the example ImtechContentQueryMain.xsl and ImtechItemStyle.xsl sheets was out of the question, so I had to retro-fit their existing XSL files with the paging controls.
  • The paging control appeared at the top of the CQWP, we needed it at the bottom.
  • We encountered an error relating to trusted XSL files in a sub-site, we did not want to have duplicate XSL files all over the place.
  • Limiting the number of records returned on large lists, so the paging controls did not stretch out the page size.

Retro-fitting existing XSL Stylesheets with the Paging Controls

As mentioned, we wanted to use our existing stylesheets, other than the ones available from the Codeplex project page: http://imtech.codeplex.com/releases/view/39782#DownloadId=104110

To do this, I loaded up a default ItemStyle.xsl file (without any changes), as well as the ImtechItemStyle.xsl file in Beyond Compare, and copied the differences out into our custom ItemStyle.xsl.

The first step, is to copy the PagingControls template into your ItemStyle.xsl – it can be placed anywhere.

  <xsl:template name="PagingControls">
    <xsl:param name="Page" />
    <xsl:param name="NumPages" />
    <xsl:if test="$Page = 1">
      <xsl:text disable-output-escaping="yes"><![CDATA[<div>]]></xsl:text>
      <xsl:if test="$PageNumber &gt; 1">
        <xsl:variable name="PreviousPageNo" select="$PageNumber - 1"/>
        <a href="?{$PagingParameterName}={$PreviousPageNo}">
          <xsl:text disable-output-escaping="yes"><![CDATA[&laquo;]]></xsl:text> Prev
        </a>
        <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
      </xsl:if>
    </xsl:if>
    <xsl:choose>
      <xsl:when test="$Page = $PageNumber">
        <strong>
          <xsl:value-of select="$Page"/>
        </strong>
      </xsl:when>
      <xsl:otherwise>
        <a href="?{$PagingParameterName}={$Page}">
          <xsl:value-of select="$Page"/>
        </a>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
    <xsl:if test="$Page &lt; $NumPages">
      <xsl:call-template name="PagingControls">
        <xsl:with-param name="Page" select="$Page + 1"/>
        <xsl:with-param name="NumPages" select="$NumPages" />
      </xsl:call-template>
    </xsl:if>
    <xsl:if test="$Page = $NumPages">
      <xsl:if test="$PageNumber &lt; $NumPages">
        <xsl:variable name="NextPageNo" select="$PageNumber + 1"/>
        <a href="?{$PagingParameterName}={$NextPageNo}">
          Next
          <xsl:text disable-output-escaping="yes"><![CDATA[&raquo;]]></xsl:text>
        </a>
      </xsl:if>
      <xsl:text disable-output-escaping="yes"><![CDATA[</div>]]></xsl:text>
    </xsl:if>
  </xsl:template>

Then, once that was in there, we need to modify the item template(s) we are using to support paging. To do this, we will use the Default template for ease of use…

Locate the start of the template

<xsl:template name="Default" match="*" mode="itemstyle">

Next, add in the following parameter right after that line in your XSL item template

<xsl:param name="CurPos" />

Your item template should now look like this:

  <xsl:template name="Default" match="*" mode="itemstyle">
    <xsl:param name="CurPos" />
    <xsl:variable name="SafeLinkUrl">
     ...

This adds in a parameter which gets the current position (row) from the list(s), we need this.

Next, we want to add in the paging. We’ll add it in its default location here, at the top of the CQWP, and show you how to move it to the bottom later in this article. Within your Default template, locate the following two lines

    </xsl:variable>
    <div class="item">

Now, we will paste in the following BEFORE <div class=”item”> and after </xsl:variable>

    <xsl:if test="$CurPos = 1 and $PageSize &gt; 0">
      <xsl:variable name="NumPages" select="ceiling($TotalRecords div $PageSize)"/>
      <xsl:if test="$NumPages &gt; 1">
        <xsl:call-template name="PagingControls">
          <xsl:with-param name="Page" select="1" />
          <xsl:with-param name="NumPages" select="$NumPages" />
        </xsl:call-template>
      </xsl:if>
    </xsl:if>

This will call the PagingControls template we added earlier, if the $CurPos = 1 (this is the first row in our CQWP), and the $PageSize is greater than 0 (meaning that we are using the paging feature in this web part).

Save your ItemStyle.xsl, and we need to next compare ImtechContentQueryMain.xsl, and ContentQueryMain.xsl.

In the ContentQueryMain.xsl file, locate this line towards the top of the file:

<xsl:param name="ClientId" />

Found it? Awesome. Paste in the following lines below that line:

    <xsl:param name="PageSize" />
    <xsl:param name="PagingParameterName" />
    <xsl:param name="TotalRecords" />
    <xsl:param name="PageNumber" />
    <xsl:param name="WebPartTitle" />
    <xsl:param name="WebPartDescription" />
    <xsl:param name="WebPartTitleUrl" />
    <xsl:param name="Locale" />
    <xsl:param name="GroupStyle" />
    <xsl:param name="ItemStyle" />

The next thing we have to do is include the CurPos (current row position) in the template OuterTemplate.CallItemTemplate. Search for that in the file, and then find <xsl:otherwise> within that template. After

<xsl:apply-templates select="." mode="itemstyle">

Add in

<xsl:with-param name="CurPos" select="$CurPosition" />

So the full template should look like this

  <xsl:template name="OuterTemplate.CallItemTemplate">
    <xsl:param name="CurPosition" />
    <xsl:value-of disable-output-escaping="yes" select="$BeginListItem" />
    <xsl:choose>
      <xsl:when test="@Style='NewsRollUpItem'">
        <xsl:apply-templates select="." mode="itemstyle">
          <xsl:with-param name="EditMode" select="$cbq_iseditmode" />
        </xsl:apply-templates>
      </xsl:when>
      <xsl:when test="@Style='NewsBigItem'">
        <xsl:apply-templates select="." mode="itemstyle">
          <xsl:with-param name="CurPos" select="$CurPosition" />
        </xsl:apply-templates>
      </xsl:when>
      <xsl:when test="@Style='NewsCategoryItem'">
        <xsl:apply-templates select="." mode="itemstyle">
          <xsl:with-param name="CurPos" select="$CurPosition" />
        </xsl:apply-templates>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="itemstyle">             

<xsl:with-param name="CurPos" select="$CurPosition" />  </xsl:apply-templates> </xsl:otherwise> </xsl:choose> <xsl:value-of disable-output-escaping="yes" select="$EndListItem" /> </xsl:template>

With the bolded line above being what we’ve added to it from the Imtech file. You can now save and close the ContentQueryMain.xsl file. And that is it for the modifications required on both the ItemStyle.xsl and ContentQueryMain.xsl files! You should now be able to use paging using your item styles and the Imtech Content Query Web Part.

Moving the Paging Control to the Bottom

Now, with the above in place, or using the Imtech XSL stylesheets, you will notice that the paging control is at the top. Well… if we want to keep in line functionality similar to SharePoint, we want to move the paging control to the bottom of the page. To do so, open up your ItemStyle.xsl file. Locate your default item style template (same one used in the last section), and locate this code, which appears after </xsl:variable> and before the starting DIV tag

    <xsl:if test="$CurPos = 1 and $PageSize &gt; 0">
      <xsl:variable name="NumPages" select="ceiling($TotalRecords div $PageSize)"/>
      <xsl:if test="$NumPages &gt; 1">
        <xsl:call-template name="PagingControls">
          <xsl:with-param name="Page" select="1" />
          <xsl:with-param name="NumPages" select="$NumPages" />
        </xsl:call-template>
      </xsl:if>
    </xsl:if>

Just cut that out. We will be moving it to the bottom of the template. now, locate the following, which ends the item style

        </div>
    </xsl:template>

Just before the closing DIV, paste the above code back in. If you save the file (and check it in – needs to be checked in to be viewable), you will see that it appears AFTER the first row returned by the CQWP. We need to add a little logic into here so we can determine if we are on the last row, and in the case of the last page where we might not have a full page, determine what the last item number is for that last page, and then display the paging controls. So the code below would be used instead of the default we just added in here.

Now, I am also going to center mine as well, so it looks a little better than just being left justified.

            <center>
              <xsl:if test="$PageSize &gt; 0">
                  <xsl:variable name="NumPages" select="ceiling($TotalRecords div $PageSize)"/>
                  <xsl:variable name="PageBeforeLast" select="$NumPages - 1"></xsl:variable>
                  <xsl:variable name="CountBeforeLastPage" select="$PageBeforeLast * $PageSize"></xsl:variable>
                  <xsl:variable name="LastPageCount" select="$TotalRecords - $CountBeforeLastPage"></xsl:variable>
                      <xsl:if test="$PageNumber = $NumPages and $CurPos = $LastPageCount">
                            <br/>
                            <xsl:call-template name="PagingControls">
                              <xsl:with-param name="Page" select="1" />
                              <xsl:with-param name="NumPages" select="$NumPages" />
                            </xsl:call-template>
                      </xsl:if>
                      <xsl:if test="$CurPos = $PageSize and $NumPages &gt; 1 and $PageNumber != $NumPages">
                        <br/>
                        <xsl:call-template name="PagingControls">
                          <xsl:with-param name="Page" select="1" />
                          <xsl:with-param name="NumPages" select="$NumPages" />
                        </xsl:call-template>
                  </xsl:if>
              </xsl:if>
            </center>

A little explanation on the above… I’ve added 3 new variables.

  • PageBeforeLast – this variable calculates the second to last page by taking the total number of pages NumPages, and then subtracts one.
  • CountBeforeLastPage – this variable gets the count of items before the last page by taking the PageBeforeLast variable, and multiplying it by the PageSize, which is the count of items per page.
  • LastPageCount – this variable gets the count of the number of items on the last page, which takes the TotalRecords variable and subtracts the CountBeforeLastPage, so if we have 23 items on the last page instead of 25, we know exactly when to implant the paging control.

Now there are two if conditions after that. The first determines if we are on the last page, and the last count. If we are at the last item on the last page, we will add in the paging control. The second if statement is used for every other page but the last one.

The web part references an untrusted XSL file.

Take a look at this discussion thread for the Extended CQWP by Imtech (the original version for 2007) – http://imtech.codeplex.com/discussions/53870. They are referencing the following error:

image

Now, this is in regards to the XSL options of the Presentation section of the Imtech Content Query Web Part properties.

image

This is very handy – so you can change these on the fly, instead of modifying the Item and Main XSL links in the XML of the web part itself. The bad news – if it is not local to the site, the following code will not work. The assembly for the Imtech CQWP is put into the GAC (if you look at the manfiest.xml file in the WSP), and, the site I was doing this on WAS in full trust mode. However, you will still get this error. To overcome this, you will need to modify the XML of the web part itself to point to your custom XSL stylesheets, if you are not using the out-of-the-box ones, which I do not recommend doing. Keep those as-is, and create new ones. To do this, export the Imtech Content Query Web Part, and open the .webpart file in a text editor. Search for: ItemXslLink and place the link to your customized Item Style XSL there:

<property name="ItemXslLink" type="string">/Style Library/XSL Style Sheets/ImtechItemStyle.xsl</property>

And the same goes for the Main XSL link, locate MainXslLink, and put in the relative URL to your ContentQueryMain XSL file:

<property name="MainXslLink" type="string">/Style Library/XSL Style Sheets/ImtechContentQueryMain.xsl</property>

Then save the file, and you can use it by uploading it to a page, or, make it re-usable by placing it in the web part gallery of your site collection(s).

Limiting the Number of Records Returned

This part is simple, but, I did want to include it. If you have thousands of items in a list, when you enable paging, and if you have your paging set at 25 or 50, you are going to see a lot of page numbers showing up, stretching out the width of your web part if you do not have a fixed width set… so, it does not look so great. Chances are, you do not need to show ALL of the items, just the most recent 50, 100, or a couple of hundred. The way to do this? In addition to using paging, if you limit the number of records returned within the default Content Query Web Part Properties, the only items page will be the number you are returning.

Resources

Microsoft has compiled some great resources on customizing the Content Query Web Part, so I want to share those with you…

And I of course need to add a link here to Heather Solomon’s article on customizing the Content Query Web Part…

Customizing the Content Query Web Part and Custom Item Styles

Speaking at SharePoint Saturday New York on 7/30/11

I am pleased to announce (a bit belated) that I will be presenting at the next SharePoint Saturday New York on July 30th, 2011.  I will be presenting Planning and Configuring Extranets in SharePoint 2010.

Most companies, large or small, require contact and collaboration with external entities, whether they are vendors, clients, or contractors. SharePoint gives us the ability to open up portals for collaboration with these external entities – this session will show you how to accomplish this using SharePoint 2010.

We will review what is required to make SharePoint “open” to the external world, discuss scenarios regarding security and privacy, as well as walk through configuring Forms Based Authentication, Claims Based Authentication, as well as using Business Connectivity Services in SharePoint 2010, to authenticate, and manage our external users.

Once completing this session, you should have a firm grasp on how to configure an extranet environment using SharePoint 2010, as well as what should be considered during the planning of your extranet scenarios.

SharePoint Saturday New York is one of the great SharePoint Saturday events – put on by some great people – Becky Isserman (@MossLover), Jason Gallicchio (@PrincetonSUG), Greg Hurlman (@ghurlman), with Tasha Scott (@TashasEv) coordinating volunteer efforts.

For more information on my session, check out my blog series on the matter here:

Planning and Configuring Extranets in SharePoint 2010–Part 1

Planning and Configuring Extranets in SharePoint 2010–Part 2

Planning and Configuring Extranets in SharePoint 2010-Part 3 “The Environment”

 

I hope to see you in New York! Oh, and by the way, registration is now open! Sign up today as space IS limited! SharePoint Saturday New York

PowerPoint Web App encountered an error. Please try again.

image

Ever seen this error? I cam across this in a new environment and was befuddled for a short while. Then, also realizing it was a new environment, I’d thought to check the service applications in Central Administration (Central Administration > Application Management > Service Applications > Manage Service Applications).

There was the problem – there was no service application configured for PowerPoint! So, the moral of this short blog post is, when using Office Web Applications in SharePoint 2010, and you receive an error similar to this, be sure to check your service applications, and make sure they exist!

This has been a Public Service Application Announcement.

Planning and Configuring Extranets in SharePoint 2010-Part 3 “The Environment”

I know quite a few people have been waiting for this post. In this post we’ll cover the environment itself, which I have made mention of in Part 1 of this series, and went through more of the configuration in during Part 2. I even made mention of it during my session at SharePoint Saturday Boston on the same subject. I have been extremely busy over the past two weeks with work, and finally had a chance today to finally put the finish touches and testing on the environment, and it is now ready for release.

extranets_csI would like to thank the folks over at CloudShare for making this possible. If you are not familiar with them – well, they say it better than I can

“CloudShare makes it easy to build, manage and share any business application instantly and on-demand, in the cloud. Used by individual business and IT professionals, developers, consultants, teams and enterprises, CloudShare offers complete and easy cloud solutions for development and testing, migration, training, demos and proofs of concept. Its latest product, CloudShare ProPlus, enables users to quickly build SharePoint environments and access preconfigured production-grade SharePoint farms – no physical servers, installs, recoding or software licensing of any kind.“

So, what they have allowed me to do, is build up a demonstration environment, using CloudShare ProPlus, and using the SharePoint and Office 2010 Information Worker Virtual Image from Microsoft as a base (actual environment setup took about 5 minutes to do – and then it was just a simple matter of configuration. Then, after taking a snapshot of that environment, I can now share that environment out. Each and every person that uses the link will have their very own copy to use. Using the link provided below you will be required to register for CloudShare Pro Plus, as a 14-day trial account, which you can play around with the image as much as you want. If you like what you see, you can keep that going, even dumping this environment and creating your own, for just $49/month. You can then share out your environments with other if you’d like. This is really one of the best cloud SaaS solutions I’ve seen on the market to date.

So, with that – have at it!

[UPDATED – NEW LINK AS OF 9.25.11] http://go.gvaro.net/ExtranetsVM3

If you have any questions or comments, please let me know in the comments below.

More posts to come within this series as well!

Finally into the Office 365 Beta Program

imageIt seems that Microsoft has done another massive push into the Office 365 Beta program. So, yesterday, after months of waiting, I was finally able to get in. I most likely not be using this blog to market off the benefits (you can find those here: Top benefits), but rather, share my observations.

One neat thing which I did not expect… the Developer Dashboard is part of O365!

image

I thought that was a pretty cool inclusion they did for this. After all, this is a hosted version of SharePoint, and they are using FBA to connect to what I can assume is an LDAP database to host accounts.

image

Anyhow, more information and observations to come… hopefully some interesting stuff.

At the very least, I now have a *.sharepoint.com subdomain… http://gvaro.sharepoint.com. That’s just cool.

Getting DLLs OUT of your non-managed code SharePoint solutions in Visual Studio 2010

Ever notice, that no matter what you package in Visual Studio 2010, even if it is a no-code solution? See the output of a build from a CustomAction below.

—— Build started: Project: Test.SharePoint.Features.MyCustomAction, Configuration: Debug Any CPU ——
  Test.SharePoint.Features.MyCustomAction -> c:\DevProjects\Test.SharePoint.Features.MyCustomAction\Test.SharePoint.Features.MyCustomAction\bin\Debug\Test.SharePoint.Features.MyCustomAction.dll
  Successfully created package at: c:\DevProjects\Test.SharePoint.Features.MyCustomAction\Test.SharePoint.Features.MyCustomAction\bin\Debug\Test.SharePoint.Features.MyCustomAction.wsp
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

There is a simple solution to this. Click on your project within the Solution Explorer in Visual Studio. And then below, or, wherever you have your Properties window, just change Include Assembly in Package to false. Then go ahead and re-package your solution. That was easy, eh?

image

SharePoint Saturday Boston 4–Recap and Materials

spsbostonWhat an event! This will be the 3rd SharePoint Saturday Boston event that I had the pleasure to help organize with Talbott Crowell and Pradeepa Siva. This was by far the smoothest as far as getting the gears cranking on it. Once the engine started, it virtually ran itself… I think our only real issue the day of, is that the breakfast caterer did not pick up their coffee containers, that and we could not figure out the AC situation, or lack there-of in some of the conference rooms. No speaker cancellations, or anything of that sort.

image

I want to start off by thanking our wonderful sponsors, who without, these events could never take place. It would take tens of thousands of dollars to pull one of these off… and that kind of money does go into these, but, not funded by registration fees from attendees. These are sponsored by some great companies, that believe in these events.

Next off, the speakers. If you are not familiar with a SharePoint Saturday event, the speakers are not paid a single cent to come and speak. There are no reimbursements for travel from us at least – some people do have companies that pick up their tab, a lot however, do not.We had speakers from all over the US, Canada, and even one from Russia. We could have all of the sponsors in the world, but, without the quality of the speakers, and their knowledge and delivery of the content, these events would not take place.

And last, but certainly not least, all of the 250+ attendees that came out on an absolutely gorgeous New England Saturday (it got me out of mulching my entire yard!), to come and network, learn, and have some fun. Again, if there were no attendees, there would be no SharePoint Saturday Boston.

For you math geeks out there, it is a simple equation, to sum up what the SharePoint Saturday ecosystem is.

Speakers + Sponsors + Attendees = SharePoint Saturday

And for my last bit of thanks – thank you to all of the people who attended my session – Planning and Configuring Extranets in SharePoint 2010. This was my first run of this session, and the feedback was very positive. Thank you all for bearing the heat in there, especially with the unending stream of hot air coming from me. I’ve posted my deck (below) at slideshare, and to all of who you are looking for a copy of the demo image – I will have that link available within the next week or two, as soon as I get it all up and running.

 

 

I am looking forward to the next SharePoint Saturday Boston, as well as other SharePoint Saturdays to come…

Planning and Configuring Extranets in SharePoint 2010–Part 2

extranetIn Part 1 of this series, we walked through creating of the actual databases for managing our FBA users, as well as the general scope of this blog series. Today, we are going to focus on the configuration of SharePoint [insert crowd roar here]. Ok, ok, I know you are excited, this however, is the hardest part IMHO, so, please pay attention, and try to color inside the lines to the best of your ability while we are following this exercise.

 

Membership and Role Providers

First, let us do a quick definition of what these are.

Membership Providers are the authentication sources for applications. A provider can be a number of back ends (LDAP, SQL, 3rd party application, or a custom membership provider). In our specific case here, we are using SQL, specifically, the ASP.NET Membership Database. If you look at the tables we created in Part 1, you can see how this provider stores a username, password, and other information about the user. Just like active directory, it can hold information about a user, and also be used for authentication.

Role Managers are similar to membership providers, however, these are more like groups in Active Directory. A person in the membership provider can belong to a number of different roles, or groups. We will be configuring these as well.

So, hopefully the brief introduction to these terms above is enough to make sense, so we can move onto our next bit.

At this point, they do not need to have a name. We can name them whatever we’d like to. So, we will use:

  • Membership Provider: SQL-MembershipProvider
  • Role Manager: SQL-RoleManager

 

Extending our Web Application with Claims Based Authentication

Now that we have our database up and running, we need to extend our web application in SharePoint 2010, so that we can create an FBA-Only authentication portal, for our partners at Contoso to access.

To do so, we need to enable Claims Based Authentication on our site, because it is already created, we need to enable our existing site to be “Claims aware”.

Note: a great blog on configuring Claims Based Authentication can be found here: http://blogs.technet.com/b/mahesm/archive/2010/04/07/configure-forms-based-authentication-fba-with-sharepoint-2010.aspx] I’ve relied heavily on that article in the past, so you will see a lot of the same information in this article as you will see in my reference above. This is not a swipe of that article, it is more of a homage 🙂

 

Extending the Web Application and Enabling Claims Authentication

To do so, go into Central Administration.

In Central Administration, go to Application Management > Manage web applications, and click on the site you would like to extend. In this example, I will be using the Intranet site within the SharePoint 2010 Information Worker demo image. Click on that site

image

And then click on Extend up in the Ribbon.

image

Now, time to configure the extended site. Give it a name, port, etc. (If you give it a DNS name, make sure you add in a DNS entry!)

image

image

Then select the Extranet zone. This doesn’t do anything but classify the extended web application, and allow us to modify the authentication methods used. Then click OK.

Now, once we have done that, you will notice, if you keep the web application selected in the list, click on Authentication Providers in the Ribbon, and then click on Extranet

image

You will notice that we cannot change the authentication type from Windows to Forms.

image

Don’t worry, we have a fix for that. To convert the web application from Classic Authentication to Claims Based Authentication, open up the SharePoint 2010 Administration Console (PowerShell – as an administrator)

image

   1: $webApp = Get-SPWebApplication http://extranet

   2: $webApp.UseClaimsAuthentication = "true"

   3: $webApp.Update()

This will enable Claims authentication on our web application.

Now if we click on Authentication Providers on the ribbon again, you can see that they now show up as Claims Based Authentication

image

Click on the Extranet again, you will now see that we can change the authentication type for this web application. If you want to have both AD users as well as FBA users to be access the same portal with their respective accounts, go ahead and check both Enable Windows Authentication as well as Enable Forms Based Authentication. Remember how I listed the Membership Provider and the Role Manager at the beginning of this article? Now is when I make use of those.

image

Note:  If you want to create a custom login page, you can specify that option from here (right below the Claims Authentication Types section). Maybe in an addendum to this article down the road I will write a quick post on how to do that. It’s easy, but, this article is more IT Pro/Admin focused, so we’ll skip that for now 🙂

Now go to the bottom and click on Save.  SharePoint will deal with the configuration of this web application.

 

Extranet Web Application Configuration

Our next item of concern is the configuration for the extranet. We need to re-configure the web.config settings for this extended web application. To do so, open the web.config file for the extranet web application, in my example, it is located at (C:\inetpub\wwwroot\wss\VirtualDirectories\extranet80\web.config)

Search for </SharePoint>, which should appear right before <system.web>, and insert the following code, after </SharePoint>, and before <system.web>.

   1: <connectionStrings> 

   2:   <add name="SQLConnectionString" connectionString="data source=DEMO2010A;Integrated Security=SSPI;Initial Catalog=aspnetdb" /> 

   3: </connectionStrings>

And where the two highlighted bits are above, insert your SQL server name, and FBA database name respectively. (see Part 1 for creating this database).

Once that is complete, locate the end of the </system.web>, mentioned above, where we just put the connectionStrings information above. It will be right above </system.webServer>. there are many other system.web declarations within this file, so be sure to use the right one. You should see tags in the XML for membership and rolemanager there.

We will leave these AS-IS! No need to modify those lines. Now, we need to add the following code within the <providers> and </providers> tags within the <membership> element, as directed in the image below

image

   1: <add connectionStringName="SQLConnectionString" 

   2: passwordAttemptWindow="5" 

   3: enablePasswordRetrieval="true" 

   4: enablePasswordReset="true" 

   5: requiresQuestionAndAnswer="true" 

   6: applicationName="/" 

   7: requiresUniqueEmail="true" 

   8: passwordFormat="Hashed" 

   9: description="Stores and Retrieves membership data from SQL Server" 

  10: name="SQL-MembershipProvider" 

  11: type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Make sure that the connectionStringName and name attributes match the connection string we used above, as well as the membership provider name we used in SharePoint respectively.

Next, the piece of xml we are going to use will fit in between the <providers> and </providers> tags within the <roleManager> element, as directed in the image below

image

   1: <add connectionStringName="SQLConnectionString" 

   2: applicationName="/" 

   3: description="Stores and retrieves roles from SQL Server" 

   4: name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 

again, making sure that the connectionStringname and name attributes match the connection string we used above, as well as the role manager name we used in SharePoint respectively.

Then save the web.config file.

Central Administration Web Application Configuration

We now need to modify the Central Administration web.config file as well. In our example here, our Central Admin web.config file is located at: C:\inetpub\wwwroot\wss\VirtualDirectories\44535\web.config

We will be editing in the same places within the config file that we did for our extranet web application above, but with just a few slight changes.

So, first, locate the closing </SharePoint> tag, and the opening <system.web>. Just as we did above, we are going to paste in our connection strings here.

   1: <connectionStrings> 

   2:   <add name="SQLConnectionString" connectionString="data source=DEMO2010A;Integrated Security=SSPI;Initial Catalog=aspnetdb" /> 

   3: </connectionStrings> 

And next, as you may have guessed, just before we close out the </system.web> tag in this web.config, we need to put in our membership provider and role information. This is slightly different from the one we used for the extranet web.config above, notice the default membership provider. Don’t change this – leave this as-is. It is NOT a typo.

   1: <roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="false"> 

   2:   <providers> 

   3:     <add connectionStringName="SQLConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 

   4:   </providers> 

   5: </roleManager> 

   6: <membership defaultProvider="SQL-MembershipProvider"> 

   7:   <providers> 

   8:     <add connectionStringName="SQLConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" description="Stores and Retrieves membership data from SQL Server" name="SQL-MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 

   9:   </providers> 

  10: </membership> 

 

Security Token Web Service Application Configuration

Last, but certainly not least, we must also update the web.config for the SecurityToken service.

Within your SharePoint Root folder, under WebServices\SecurityToken (generally found at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken), you will find another web.config file. Before the end <configuration> </configuration> section, add in the following… again, tailored to your configuration which we have specified above.

   1: <connectionStrings> 

   2:     <add name="SQL-ConnectionString" connectionString="data source=DEMO2010A;Integrated Security=SSPI;Initial Catalog=aspnetdb" /> 

   3: </connectionStrings> 

   4: <system.web> 

   5:     <roleManager defaultProvider="c" enabled="true" cacheRolesInCookie="false"> 

   6:         <providers> 

   7:             <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> 

   8:             <add connectionStringName="SQL-ConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 

   9:         </providers> 

  10:     </roleManager> 

  11:     <membership defaultProvider="i"> 

  12:         <providers> 

  13:             <add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> 

  14:             <add connectionStringName="SQL-ConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" description="Stores and Retrieves membership data from SQL Server" name="SQL-MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 

  15:         </providers> 

  16:     </membership> 

  17: </system.web>

Once you do that, it would be healthy to restart IIS as well (just humor me on this one, while not required, as changes to the web.config will cause the application pools to recycle, I’ve seen issues where a reset to IIS has been known to do good).

And lastly, once you visit your site, you should get one of these nice choice boxes:

 

image

You should be configured, and ready to roll!

Now stay tuned for Part 3… get access to this test environment!