Alternate Access Mappings

After installing and setting up a MOSS environment, we want to make sure our users have easy access. Most of the times the computername is selected by some network administrator and doesn’t match what we think is easy. Adding a DNS records and alternate access mappings can solve this problem if installed the right way.

This can be done like this:

  • Setup a DNS record to forward a friendly name like sharepoint.company.com to the IP address of your server.
  • Add an ‘alternate access mapping’ to the new dns name in SharePoint. This is done via the ‘Alternate access mappings’ menu item which is found under ‘Global Configuration’ on the Operations page of the Central Administration Pages.
  • Make sure IE knows this page is on the intranet if it’s asking for login data in a prompt (which you don’t want I presume). I didn’t know this, but adding the site to the ‘trusted sites’ list isn’t the correct solution: you really have to add it to the ‘intranet’ category.

After these 3 steps, users should be able to visit your sharepoint site via http://sharepoint.company.com without receiving a login prompt (when visited internally offcourse; this doesn’t apply for internet connections).

New Microsoft Surface video

Most of you will have seen Surface by now. Surface is a multi-touch display built into a table with very nice user interaction. I really dig new types of intuitive interfaces and this definitely is one of those. I found a new (it’s not brand new, but I didn’t see it before) video on YouTube which has a little more detail on surface and the technology behind (or actually below) it.

By the way, another really cool new technology is called ‘Photosynth’ and it’s also by Microsoft. Now I would love to see the two combined, but for now you can view a demonstration of photosynth or check out the online version yourself.

Integrated security and SQL Server in ASP.NET

On a project I’m currently developing I needed to keep track of changes to database records made by users. Typically you would add 4 columns for this purpose: CreatedBy, CreatedOn, ModifiedBy and ModifiedOn. Filling these columns can be done via business logic offcourse, but I was looking for a sweeter solution (and found one!).

As most of you guys probably know, getting the current date/time isn’t that hard in SQL code. Just use the GETDATE() function as the default value in you INSERT and UPDATE queries. Ok, but how about the username? Here’s where integrated security is going to help us.

ASP.NET provides integrated security to be able to use the Windows account of the user using your application for other things in need of authentication (writing files, connecting to other computers, and also to SQL Server databases). The only thing you need to do to enable integrated security is setting <identityimpersonate=true/> and <authenticationmode=Windows/> in your web.config file. Using integrated authentication with SQL Server isn’t that hard either; just provide the string Integrated Security=True in your connectionstring.

Now you need to grant access to the domain users to your SQL Server database. Default public rights are enough here, don’t overdo it because you don’t want to grant too much rights to all of your Active Directory users. That’s it! To retrieve the username of the user currently logged into SQL Server you may use ‘USER_NAME()’ in your queries. So now you’re ably to fill all 4 columns mentioned above without having to write a single line of code; isn’t that sweet!?

Crystal Reports Web Part – part 2

Earlier, I wrote a blogpost about creating a web part to display Crystal Report files. The biggest problem faced was the displaying of images on a report (which include graphs, pie charts and more stuff like that) which wouldn’t work in a MOSS environment. I solved it by creating a second web application to ‘host’ the imagehandler which handles the image requests made by IMG SRC=” tags.

On the MSDN Forum, I found a post made by someone with a similar problem. After solving the problem I replied posting my solution and left it alone. Luckily, I had the post alerts still on to notify me about a new reply being posted. Svetlana came up with two interesting solutions for the exact same problem, which are a bit more elegant if you ask me:

  • Rename the CrystalImageHandler.aspx file to a different extension, so the MOSS handler won’t pick it up. Offcourse you’ll have to alter the web.config to include a handler to the correct file.
  • Place a custom made CrystalImageHandler.aspx file in the TEMPLATE/LAYOUTS directory of the 12 hyve. Now write a regex which will replace all calls to the old imagehandler with a call to that file which will be in the _layouts directory of your web app.

I’ll see if I can post the contents of the CrystalImageHandler.aspx file and the web part regex to get you guys on your way. And again: thanks to Svetlana for providing this solution!

Update! The fully functional, ready-to-go web part with installation guide and support is now on sale!

No permission to create MySite

After switching the authentication provider on our SharePoint installation from NTLM to Kerberos (which should be better), users started to complain that they weren’t able to create a MySite anymore. I checked and offcourse they were right.

To use Kerberos, I had to change the application pool account to the Network Service. That account isn’t a Farm Administrator by default, so you’ll have to add it to that group via the Central Administration pages. After that it should all work again.

By the way: on creation of the MySite, the error received states that the permissions to create a MySite were turned off. That’s very misleading because they weren’t!

Printing SharePoint lists

In a blogpost by Ishai I found some code which enables users to print out lists in a printerfriendly view; something which is missing in SharePoint by default.

To enhance the feature a little bit more, you can edit the printlist.xml file to include a description (which is displayed below the title of the menu item) and an image (which is displayed in front of the image).

For instance:

<CustomAction Id=”SPSTIPS.PrintListActionsToolbar”
RegistrationType=”List”
GroupId=”ActionsMenu”
Location=”Microsoft.SharePoint.StandardMenu”
Sequence=”1000″
Title=”Afdrukken”
Description=”Open deze lijst in afdrukweergave in een nieuw venster.”
ImageUrl=”/_layouts/images/MENUPRINT.GIF”>
<UrlAction Url=”{SiteUrl}/_layouts/PrintList.aspx?list={ListId}”/>
</CustomAction>

The image you use should be a GIF with a dimension of 34×34 pixels. Place it in the TEMPLATE\IMAGES directory in your 12 hyve.

MOSS Development updates!

Hurray! Some nice new development packages have arrived from Redmond! They bring some interesting new features and tools which should make our lives as developers a bit easier.

Direct download links:
MOSS 2007 SDK 1.2
WSS 3.0  SDK 1.2
Visual Studio Extensions for Windows SharePoint Services 3.0 CTP 1.1

Please check out the Microsoft SharePoint Products and Technologies Team Blog for more information on these updates.

MCTS Certified!

Yeah! After reading two quite lengthy books (and for me that’s a lot of reading compared to the things I usually read…) in not so much time, and taking two not too easy exams, I made it! I’m now officially a Microsoft Certified Technology Specialist. Guess I’m going to need new business cards to fit that title 😉 So now that I’m supposed to know a lot of ASP.NET web development, more blogposts will arrive shortly!

And not to worry… I won’t waste my newly gained free time, I’m thinking about taking bass lessons and maybe update the title to MCPD, but on a slower paste this time. But first: celebration time! 😀

Crystal Reports Web Part for MOSS 2007

To enable our users to view Crystal Reports in a SharePoint environment, we looked for a solution of Business Objects. Unfortunately, that only seems to be available for SharePoint 2003, and not 2007. Also obtaining it seems not that easy, at least it’s not included in the default developer edition of Crystal Reports XI.

So we decided to create one ourselves by using the standard ASP.NET reportviewer control. The web part consists of the CR reportviewer and CR reportsource which, when combined, display the report in the javascript viewer for ASP.NET. One of the problems to overcome is the lack of ability to use online files via http in the reportsource; by default only local files on the hard drive are supported.

A second problem is caused by the http handler Crystal uses to process images. That won’t work in a MOSS environment because the MOSS handlers kick in before the Crystal handler can even process the request. I tried changing the sequence in web.config so the Crystal handler would process first, but couldn’t get that to work properly. I ended up creating an empty web application on a different (non-MOSS) port and redirecting the CrystalImageHandler.aspx requests to that application by simply replacing those URLs in the outputted sourcecode of the web part with a regular expression. Maybe not the best solution, but it works quite well.

Unfortunately I cannot post the web part here since it’s made for the company I work at. Though you may contact me at jsiegmund [at] datamex [dot] nl to work something out (we don’t have an online shop).

Update! Also check out this new post!

Update 2! The fully functional, ready-to-go web part with installation guide and support is now on sale!

InfoPath, SSO and SQL Server credentials

Here’s a quick walkthrough to enable a InfoPath form to get information from a SQL Server database with credentials found in a SSO database (which you typically use with SharePoint).

Read More