Atlanta .NET Regular Guys

Community Blog for two guys in Atlanta that focus on Microsoft and Community.

Quick About

This is the community blog for Brendon Schwartz and Matt Ranlett.  If you want to see their technical posts visit http://www.sharepointguys.com

Back To DevCow

Recent Posts

Tags

Email Notifications

    Archives

    September 2007 - Posts

    October Atlanta Microsoft Professionals meeting - new location alert!
    Please join us on Monday, October 1 at 6:30 PM for the monthly Atlanta Cutting Edge .NET / MsPros / VB Study Group meeting.

    Note, for this meeting we will be meeting at Turner in midtown (1015 Techwood Drive) rather than the usual Microsoft offices. If you haven't attended meetings in the past due to location, here's your chance to let us know if this facility is better. Scroll to the bottom of this message for directions to the meeting.

    To register for this event, please go to http://www.clicktoattend.com/?id=121536. Registration for this meeting is required in order to get you through Turner's security.

    Presentation Topics
    Speaker: Steve Porter
    Topic: Windows Workflow Rules Engine
    This talk explores creating, maintaining and executing business rules using the Windows Workflow (WF) rules engine.

    Speaker: Rik Robinson
    Topic: Deep Dive CSS for the ASP.NET Developer
    This will be a thorough discussion of all that is CSS. Whether you know it as the necessary evil or the great enabler (that just hasn’t quite clicked for you yet), you should walk away with something valuable from this discussion. I will begin with the basic box model and travel all the way to the holiest of grails (the no tables here, two and three column ASP.NET Master Page layout…yours to take home for free!). Along the way, we’ll touch on some CSS Best Practices and gotchas in ASP.NET and take a look at the new CSS tools in Visual Studio 2008 (Orcas).
    Rik Robinson is an Independent Consultant in the Atlanta GA area. He holds the following certifications (all .NET Framework 2.0): MCPD –Enterprise Applications, MCTS-Web, MCTS-Windows, MCTS-Distributed Applications. He really hates that he has to type this in third person like someone else wrote it. Rik is supposed to maintain his blog at www.r2musings.com. He will soon, I’m sure. Rik’s focus is always on the User Experience (both the end user’s and the developer’s).

    NOTE: Different location! We will be meeting at the Turner Broadcasting in Atlanta

    Directions to Techwood
    Marta Rail System: Midtown Stop on the North/South Line

    FROM I-75/I-85 NORTH HEADING NORTH
    • Travel North on I-75 and I-85.
    • Take 10th Street/14th Street/Techwood Drive/Georgia Tech exit (Exit #250)
    • Turn left at first red light, onto Tenth Street (heading West)
    • Turn right onto Techwood Drive and left into the visitor entrance.
    • Pull up to window of the GateHouse and Security Officers will direct you to visitor parking
    • Take the parking deck elevator to the 1st floor of the 1000 Bldg and check in with the receptionist in the lobby. Tell them you are with the Atlanta MS Pros.
    FROM I-75/I-85 SOUTH HEADING SOUTH
    • Travel South on I-75 or I-85.
    • Take Techwood Drive/Tenth Street/Fourteenth Street exit (Exit #84)
    • Go straight ahead and the exit ramp turns into Techwood Drive
    • Cross 14th Street and stay in the right lane.
    • Turn right into the visitor entrance on Techwood Drive
    • Pull up to window of the GateHouse and Security Officers will direct you to visitor parking
    • Take the parking deck elevator to the 1st floor of the 1000 Bldg and check in with the receptionist in the lobby. Tell them you are with the Atlanta MS Pros.
    Thanks, and I hope to see everyone at this month's meeting!
    Be sure to use distinct names in your SharePoint Web Applications

    If you are creating an externally accessible portal or extranet with SharePoint which uses Forms based authentication, business requirements such as Search and ECM Publishing might require you to create an intranet portal which uses NTLM or Kerberos authentication.  To do this, you'd first create a Web Application in SharePoint, then you'd go back and extend that web application to add the second zone.  However tempting it might be to give these portals the same description, don't.  The misnamed Description field is actually the name that shows up in the IIS Manager application.  If you give two Web Apps the same name, they won't get distinct entries in the IIS Admin web sites section.  This has the effect of IIS not being able to find your site and sending incoming requests for the duplicate named site to the default web site (which normally shows a "Under Construction" message)

    SharePoint Web Application Description field    IISAdmin Sites list

    Be careful about hard coding Javascript in SharePoint 2007

    Have you ever gotten "Please wait while scripts are loaded..." in SharePoint 2007?  This is caused by a script error on the current SharePoint page.  To solve this problem just fix the javascript errors on the page and it should go away.  If you are a using a minimal or custom WCM master page you might run into this.  One place you might see this after applying a new master page is in the Survey form.  This is due to a hard coded script line in a content area that tries to set an element without checking if the element exists first.  Actually this should happen in an list that uses the form.aspx where the code actually lives.

    <script id="onetidPageTitleAreaFrameScript">
        document.getElementById("onetidPageTitleAreaFrame").className="ms-areaseparator";
    </script>

    If you don't have this element the message to wait for scripts will never go away.  To define the element just add it to a table as defined on the default.master page like the following table row:

    <td valign=top id="onetidPageTitleAreaFrame" class='ms-pagetitleareaframe' nowrap>

    Phew - coming to the end of a long dark tunnel

    OMFG I've been working heads down on a project for the last several months which has consumed a huge portion of my time and probably some of my hair.  Even now, as I write this, I'm in the process of developing some stuff which was due last week, rebuilding the server which blew up over the weekend, and managing client expectations the whole while.  Oh, let me not forget to mention that Brendon and I managed to write what I think is a pretty insightful article on Office SharePoint Server Search technologies for ASP.Net Pro magazine in the last 10 days!

    It's been lots of work to get to the end of this road and lots has happened.  I've got a new laptop, I've discovered Facebook, and I've got lots of lessons learned to share with everyone.  Look for posts on these topics and more in the coming days!

    Posted: 09-11-2007 7:48 AM by Matt Ranlett | with no comments
    Filed under:
    Using SAP iViews with SharePoint 2007

    One of the easiest ways to integrate SharePoint 2007 to SAP is using a predefined iView from SAP.  Of course this will display the same data and view that you would see in any other system that would display an iView, but it is a good start without any extra coding.

    1. First add an IView web part to the page.

      image
    2. The next step seems like it should be easy.  Open the tool pane and select the trusted SAP portal server as well as the iView. 
      image
    3. The problem is that the first time you are setting up your server you will get an error "No SAP® servers are configured for this site. Contact your administrator to configure trusted SAP® servers."  Don't worry you just need to set up your SAP server locations. 
      image
    4. To set up the SAP server create a configuration file with the web location of the SAP server and the SSO application.  If you have the default installation of MOSS this will be under the folder C:\Program Files\Microsoft Office Servers\12.0\Config.  You will notice there is an example configuration file named TrustedSAPHosts.xml.sample, just rename the file to TrustedSAPHosts.config.  This will allow SharePoint to find the registered SAP servers.
    5. Inside of the xml configuration file there are two elements that have to be set: ServerURL (The server with port number of the SAP Server) and the SsoAuthentication (The SSO application in Central Administration site)

      <!-- This is from the config file -->
       <Server Name="SAPServer">
          <ServerURL>http://SAPServer:50100</ServerURL>    
          <SsoAuthentication Name="SAP"/>
       </Server>
    6. Now go back to the web part and open the tool pane once again.  Simply select the SAP server to use and type in the name of the iView to display.

      image
    Custom SharePoint List-based Membership and Roles Provider

    I've finally finished (almost) with the project that has been keeping me up late at night.  I want to thank Doug Ware, Brendon Schwartz, Dan Attis, and Adam Buenz for all the help they gave me over the past several months while I struggled to bring this beast to its knees.

    I did some cool work so I thought I'd post it online.  Look for this to be the focus of several upcoming blog posts and eventually a white paper of some sort or other.

    I sought out and received permission from my employer, Intellinet, and my client, Preparis, to post this code online in its entirety.

    CodePlex banner Here is the code - http://www.codeplex.com/SPListMP

    I've created a custom membership and role provider for SharePoint, which uses a SharePoint list as the backing store for users.  This gives me a couple of neat benefits:

    1. I've got totally discrete user stores despite the fact that potentially dozens of site collections are on the same server.  This means I can back up my users along with my site!
    2. I've got familiar and easy to use list management tools to maintain my users and my roles
    3. I've got the ability to do cool custom code based on my custom roles, including the ability to have custom welcome pages for each user role (ok, so this isn't restricted to my custom providers, but it's cool nonetheless)

    I'm excited about this, and I plan to work on the code a lot as time goes on to get it right.  The code works now, but there are elements I'm not that proud of as I was forced to make cuts to get it done and out the door.

    Application Error for every new site collection using Network Services account

    Have you ever been testing new web applications in SharePoint and constantly gotten the Runtime Error (Server Error in '/').  If you do get this error the real error might be displayed in the event log like the one I found below. 

    Exception information:
        Exception type: HttpException
        Exception message: The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.


    Request information:
        Request URL: http://sharepoint.devcow.com/
        Request path: /
        User host address: 127.0.0.1
        User: 
        Is authenticated: False
        Authentication Type: 
        Thread account name: NT AUTHORITY\NETWORK SERVICE

     

    A common problem that I just recently saw when creating site collections using the Network Services account for the app pool was a restriction to the ASP.NET Temporary files.  This is due to the fact that the Network Services account is a restricted account, so by default it will not have permissions to everything another account, say an administrator, would have.

    Keep this in mind next time you create a new site collection or web application and get the Runtime Error screen.  Go and check the event logs to see if the error is in there before you try to perform the actions asked on the screen, like changing the web.config which won't work.

    MSDN Event in GA tomorrow

    If you want to learn about cutting edge technologies, attend the MSDN event tomorrow.  If you don't live in GA there might be one close to where you live. You can find the other locations at http://www.msdnevents.com/

    Register for the event if you are going: http://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-US&EventID=1032345140

    MSDN Events – Silverlight, LINQ and WCF

    Event ID: 1032345140

    Tuesday, September 11, 2007 1:00 PM - Tuesday, September 11, 2007 5:00 PM Eastern Time (US & Canada)
    Welcome Time: 12:00 PM

    Theater - AMC Parkway Pointe

    3101 Cobb Parkway
    Atlanta Georgia 30339
    United States

    Set up SharePoint sites with user profiles and SSP correctly

    SharePoint 2007 sites that are created can have many configuration options, due to this some options can be overlooked.  Most users are able to set the options that are in the Central Administration without any trouble because all of the options are in one place.  The trouble usually comes with setting options for the Site Collection like the search scopes or variation settings.  One setting that most people forget to set is the Portal Site Connection setting that we will look at in this post.

    Setting the Portal Site Connection values

    The Portal Site Connection description on the setting page doesn't really make a lot of sense for what it does.  In fact from reading the description you may not think you need to set the value.  This setting does help set up the site correctly and when using this setting the functionality of some of the pages changes.  For instance, with the portal site connection enabled you are providing a link to another portal in the global navigation (Figure 1) and the user profiles show their My Site page (Figure 2).

    Want steps to set up a portal site connection? Check out instructions here:

    http://blogs.msdn.com/wael/archive/2007/07/01/how-to-change-the-view-from-userdisp-aspx-to-mysite-view.aspx

    image
    Figure 1

    Display Users My Site Page from userdisp.aspx

    Another use for the portal site connection is linking the user profiles to their display page in My Site.  However, this will only work if the user has a profile in the Shared Service user profile store. Once the portal site connection is set and assuming the user has a profile, when you click on a user's name, such as http://sharepoint.devcow.com/_layouts/userdisp.aspx?ID=16, it will take you to their My Site page. 

    image
    Figure 2

    Display for users without Shared Service Profiles

    Many people have commented that this doesn't work for all of their site users especially FBA users. If you don't have a user profile set up in the Shared Service profile, SharePoint cannot resolve the user for a My Site view.  Instead, you will get the standard WSS view that you get for the user profile.  You might notice something a little different though - the page shows all of the fields in the display page (userdisp.aspx), but only shows a read only view of the users login and edit columns for user defined columns in the edit page (useredit.aspx).  This happens when you add the site to a Shared Service provider because the User Info list is modified to not show those values in the edit mode.

    Steps to set up a Site Collection

    Putting this all together now, here are the steps to correctly set up your Site Collection if you are using a Shared Service provider with the web application and also using the user profile store.

    1. Create a web application and create a site collection (http://www.pptspaces.com/sharepointreporterblog/Lists/Posts/Post.aspx?ID=21)
    2. Add a Shared Service provider (http://www.pptspaces.com/sharepointreporterblog/Lists/Posts/Post.aspx?ID=18)
    3. This is a key step that is usually missed!  Setup the Portal Site Connection values (http://blogs.msdn.com/wael/archive/2007/07/01/how-to-change-the-view-from-userdisp-aspx-to-mysite-view.aspx).  In some cases I was able to remove the Portal Site Connection afterwards, or at least point to another site that is really the main Intranet site - such as http://intranet.

    It appears there is a flag or setting that tells the userdisp page to use a Shared Service provider.  It may be a bug that the flag does not get set when associated a Site Collection to a Shared Service Provider.  Maybe the flag should get set automatically when the Site Collection is added to the Shared Service provider, because the User Info List is modified when it is added.

    Community Kit for SharePoint (CKS) - Internet/Extranet Edition (IEE)

    If you are interested in user profiles for the Internet or using Forms Based Authentication (FBA), we will have a release of the IEE project soon.  This should have some enhancements for storing user profiles with FBA as well as being able to edit them from the user interface.  Check out the site http://www.codeplex.com/cks.

    Possible Problems

    NOTE: In trying this out, I have come across some bizarre actions.

    Here are some of the things I have seen.

    1. Setting the Portal Site Connection of a Site Collection without a Shared Service Provider added that site to the Shared Service provider.  Prior to changing the Portal Site Connection value the Site Collection did not have a shared service provider associated with it.

    2. After setting up the Portal Site Connection and testing that the users display the MySite page, I removed the Portal Site Connection.  After I performed these actions, the users with profiles still display the MySite page from the userdisp.aspx page.   

    Useful User Groups list for the Atlanta area

    I don't remember if I posted this list before, but I maintain a list of user groups in the Atlanta area on DevCow.com and thought I would share it with everyone.  Each group that we keep up with is listed with a link to their site.  I even maintain this list with a flag that shows if it focuses on Microsoft products or not.  All of the groups would be helpful to Microsoft developers so only look at that as a guide.

    You can even export the list to excel if you really want to.  Keep in mind this list doesn't change very often, but if you have one that needs to be added or if one link doesn't work email Brendon at bschwartz[@]devcow.com.  We will update the database with the information.

    Check out the list at: http://www.devcow.com/usergroups/

    Matt's chapter from the SharePoint 2007 book on Wrox.com

    If you didn't know Me (Brendon), Matt and Dan worked on a SharePoint book this past year.  Today part of Matt's chapter, chapter 5 ("Programming Windows SharePoint Services") was posted on the Wrox website.

    You can check it out here:

    http://www.wrox.com/WileyCDA/Section/id-306329.html

    This is a great read and in fact check out the quote of one of the reviewers on Matt's chapter.

    "This chapter alone would [be] worth the purchase of the whole book"

    Amazon review of the book

    Awesome job Matt, keep up the good work!

    SPWeb.AuthenticationMode always returns WindowsAuthentication

    I am trying to determine what type of authentication the current SharePoint 2007 web site has, but no matter which SharePoint site I checked the AuthenticationMode of the SPWeb always seems to return WindowsAuthentication.  The site that I am using is set up with Forms Based Authentication (FBA), and I would think that SharePoint object model would know the current authentication mode should be  AuthenticationMode.Forms, but it doesn't.

    I am not sure if I am just missing something?  Maybe you really do have to go to the WebApplication and the IISSettings to get the actual value.  Seems like a long way to go to get what you need.  Keep in mind that to get the IISSettings you will also need to know which zone the site is.  Using the Alternate URLs this can be done with the URL of the site.

    Let me know if you have a better way.  For now it looks like this might be a clean way to get what you want.  You can also use the current SPWeb instead of hardcoding it, but this is easier for Console Apps and to make it more clear.

    using (SPSite spSite = new SPSite(@"http://fba.devcow.com"))
    {
        SPWeb spweb = spSite.RootWeb;
        SPWebApplication webApp = spweb.Site.WebApplication;

        SPAlternateUrl altURL = webApp.AlternateUrls[spweb.Url];

        SPIisSettings iisSettings = webApp.IisSettings[altURL.UrlZone];
        Console.WriteLine(iisSettings.AuthenticationMode);
    }