2834 Views // 0 Comments // Not Rated

Office 2007 Integration With The SharePoint 2007 Hybrid Provider

One of the first things that didn't work with my Hybrid Provider was opening Office documents from SharePoint. Since SharePoint loads the doc from the server, the user is re-authenticated before the client application will open it. In fact, when setting up a forms-based membership provider for SharePoint, a note on the page warns that client integration with forms auth is problematic. You actually have to check a box to enable it!

Bah! Office integration is huge part of SharePoint, especially since 2007 has been betrothed and married into the Office family! Although the Hybrid Provider talks to AD, it still is essentially forms-based authentication, and therefore falls into this warning. But never fear: getting it all to work is actually quite simple.

All the user has to do is check the "Remember Me" box on the login page. (By default, this is UserLogin.aspx, located in the web app's root folder.) This checkbox is a standard part of the ASP.NET 2.0 login control, which provides the magic by which our SQL users can be invited to the SharePoint party. What this does behind the scenes is set a cookie that Office picks up and uses for the re-authentication. The user doesn't even have to reenter their credentials!

To make this even easier, you can write a little bit of markup to default this box to checked, and even hide it altogether. Just set the "RememberMeSet" property to true in the login control's HTML. This will check the box when the page loads. You can also set several other properties of the checkbox, including the CSS class name.

What took a bit more work was hiding the damn thing. We tried to create a CSS class that has visibility set to hidden, but it wouldn't take. Manipulating SharePoint CSS is a monstrous task, and since I'm a programmer and not a designer, I quickly gave up on CSS and turned to JavaScript. After setting the aforementioned property to check the box, add the following attribute to the page's body tag and users will have seamless Office integration with the Hybrid Provider:

Code Listing 1

  1. /><body onload="document.getElementById('[ID OF LOGIN CONTROL]_RememberMe').style.visibility = 'hidden';">

Obviously, if the user has JavaScript and/or cookies disabled in their browser, pretty much nothing will work, let along the login page. Therefore, these modifications should not introduce any regression problems.

7 Tags

No Files

No Thoughts

Your Thoughts?

You need to login with Twitter to share a Thought on this post.