Saturday, December 18, 2010

Not taking action is not always the best strategy

As part of my work, I often review how clients are managing their SharePoint farm. I've started to recognize a trend that I find a little disconcerting. It relates to applying operating system updates to Windows Servers. I find that the majority of my clients do not apply these automatically. The reason is that they feel that these updates may cause issues on the server. Let's be honest, there are plenty of examples of this happening, so this is not a unfounded concern.

But what is the downside of this approach? It means that their server is exposed to the issues that these patches apply to. To me, this is a significantly greater risk than a system becoming unavailable. Users may be unhappy if a server is offline, but what are the consequences of a hacker gaining access to your network?

I think there are two basic approaches you can take - turn on automatic updates or review and test each update that is released. These are the two extreme cases, but I know which end of the spectrum I would much rather be on. The number of companies with the skills and time to evaluate each update is small. Enabling monitoring of servers and services is relatively cost effective and has benefits above and beyond patch management.

Keeping the window of opportunity as small as possible for hackers is something every administrator should be trying to do. Hackers aren't after your servers specifically, they are just after the softest targets. Try not to be at the back of the herd when they attack.

Sunday, November 21, 2010

Using the System.Diagnostics EventLog.WriteEntry

Disclaimer – I’m a part-time developer. Do not assume that any coding advice that you read here is “best practice”.

I’ve been working on a SharePoint timer job in SharePoint 2007. To make it easier to find out what is going on within the job, I want to write to a log. From my perspective, the best log to use is the Windows Application log. This is a location that server administrators are familiar with accessing and there are many monitoring products out there that can keep an eye on it for you.

The Microsoft Dot Net Framework includes a System.Diagnostics namespace to help you interact with the Windows Logs. Initially I thought it would be a straightforward job to just call the Eventlog.WriteEntry() method. That’s when I disappeared down the rabbit hole of MSDN articles and blog posts.

Here’s what I’ve discovered in my journey:

When writing to the event log you need to specify a Source. This identifies the process that generated the error. This column is shown in the Windows Application Log and it can be used for filtering. It may be possible to use pre-existing ones, but I wanted to use my own.

When you use the EventLog.WriteEntry() method with a Source that doesn’t already exist, Windows will try to create the source for you. Behind the scenes, that involves updating the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application (assuming you are writing to the Application log). The problem is that your code may not have permissions to update that location, which causes your code to throw an exception. Trust me, it can take a while to realise that your error handling code is the component that is causing the problems.

You’ll find a number of blog posts and forum responses out there about granting ASPNet accounts permissions to registry keys. I really don’t like including steps like that as part of a deployment, so I continued to look for another approach. As an aside, since my code is a timer job, it will be running under the credentials of the account configured for the OWSTimer service. Even when I granted this account permissions to the Application and Security registry keys AND ran the code using the SPSecurity.RunWithElevatedPrivileges, I still couldn’t get it to create the Event Log source for me.

If your read this KB article you might decide to create the source manually by adding a registry key under the KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application key and giving it the same name as the Source parameter in your call to eventLog.WriteEntry(). This will stop your call to EventLog.WriteEntry() crashing, however – you’ll probably start seeing longwinded error messages in your eventlogs such as:

The description for Event ID 0 from source YourSourceName cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

The actual text from you event will be appended. Not ideal, is it?

It turns out that event log messages are usually generated by passing an ID along with some parameters. This gets cross-referenced with a “message log file” and translated into the text seen in the event log. This makes translating errors into multiple languages easy. So what Windows is trying to tell us in the previous message is that it cannot find this message log file, which isn’t surprising, because I didn’t create one.

Now if I were a real developer, I’d probably go off and create a message log file, bundle it up and register it using all the proper ways and means. But I’m not. I just want to write a message to the Windows Event Logs.

So here’s the approach I worked out. I created a simple Dot Net console app. I included a reference to the System.Diagnostics namespace, and I added one line of code to the main() method -

EventLog.CreateEventSource("MySourceName", "Application");

I then run this application directly on the server (Windows 2008 Standard in this case) while I’m logged on as a local administrator. I checked the registry and confirmed that a new key had been added to the KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application location. This key includes a value that references EventLogMessages.dll

EventLog

This is a reference to one of those message log files I mentioned earlier. It basically contains a simple mapping rule that outputs whatever text you pass EventLog.WriteEntry(). I rebooted the server at this stage. This may not be necessary, perhaps I could have just restarted the timer job service. I’ll leave that as an exercise for the reader.

Once the machine came back online, my timer job started writing to the event log without all the extra “the description of the event not found”. Now if I’m working on a multi-server SharePoint farm, I’d run my little console app on each of the servers to ensure that they all get the registry settings. I could even get trickier and make the console app use a command line parameter for my Source name, but I don’t want to stretch my luck.

One of Microsoft’s support articles mentions using an EventLogInstaller class to register the source. That worked too, but I found the console app easier to create and easier to implement in a production environment. I’m not sure what the advantages are with the EventLogInstallter, perhaps it makes sense if you are creating more complicated setup applications.

Here’s a link to an MSDN magazine article that explained a lot of the process to me:

http://msdn.microsoft.com/en-us/magazine/cc163446.aspx#S3

Monday, October 18, 2010

Sydney SharePoint User Group - The Reluctant Database Administrator

Don’t forget that the October SharePoint User Group in Sydney is tomorrow, Tuesday 19th. Victor Isakov will be discussing what a SharePoint Administrator should know if they become responsible for the SQL Server. More details available at http://www.sharepointusers.org.au/sydney. If you do want to come along, just e-mail sydney@sharepointusers.org.au so that we know you are coming.

Saturday, October 09, 2010

SharePoint 2010 and the iPad

I have always loved gadgets. If it were true that these gadgets are productivity enhancing devices then I should be one of the most productive people alive. Sadly, this is not the case. It just seems that I can be unproductive in a lot more places than before.

Recently I caved in to temptation and got myself an iPad. Many people have sneered at this device, but I have always considered it a brave move by Apple. It is an untested format in the marketplace. I think that only time will tell whether they carve out a place in peoples work and personal life or whether it goes the way of the Internet connected fridge. I also hope that other vendors innovate around this format, more choice is always better.

The main reason I gave myself for getting an iPad is so that I can become familiar with how it integrates with SharePoint. I know deep down that I really got one coz they are shiny and new, but the lie is easier to live with. In truth though, many of the clients that I work with have expressed interest in using iPads or have actually started to trial them. So I thought I might share some of my experiences here on the blog.

Firstly, I have come across two iPad applications in the App Store - SharePlus and Filamente. Both of these allow you to access a Sharepoint site, lists libraries and sub sites. Both provide the ability to sync content so that you can access it offline, and both have their own little quirks. These are version 1 products, hopefully reliability will get better as they mature. Neither of these applications gives the user the same experience as if they were using a web browser, they focus on letting you see content in your SharePoint lists and libraries.

Another option is to use the iPad Safari browser. This proves to be a nice option for online access. If I am in my office I can access the site by entering a fully qualified domain name (e.g. http://somewhere.officenetwork.local). Even though the site is also available on a shorter name of http://somewhere, the iPad doesn't seem to be able to use that. Of course you will need to ensure that your Alternate Access Mapping and IIS host headers are correctly set up for this to work.

Outside my office I have been able to connect to my intranet through the iPads VPN functionality. We also publish our intranet externally using Microsoft Threat Management Gateway over SSL, the iPad browser has no issue with this either, however the two iPad apps didn't accept this method of connecting.

Not everything works perfectly through the safari browser when accessing a SharePoint 2010 site. Vertical and horizontal scrolling can be troublesome, rotating the display between portrait and landscape seems to fix this some times, two-finger scrolling is another trick that has mixed results. Pinching to zoom in and out of the page has rarely worked for me. I've also noticed that the people picker field only lets you search for a name, not type one in directly. You can create, edit and delete list items but don't expect to use any of the more advanced rich text editing functionality.

One area that I think holds a lot of promise on the iPad is the Office Web Applications and InfoPath Forms Services. I haven't had a chance to check these out myself yet (see earlier comments on productivity) but Dux Raymond Sy has an interesting video that shows some of these in action.

So I shall continue to explore the capabilities of the device and share what I learn here. Stay tuned.

Saturday, September 18, 2010

Don’t Do What Johnny Don’t Does

You know that sense of relief that you get when you stop banging your head against a brick wall? Well, I experienced that this week and I thought I’d share, just in case there are others out there that are going through the same.

I was setting up a SharePoint 2010 environment and configuring it to index PDF documents. This is still a manual task in SharePoint 2010 as the components are not built in to the platform. However, it’s not that hard. If you go about it the right way that is.

You should already know that SharePoint 2010 will only run on a 64-bit operating system. Therefore you are going to need a 64-bit PDF iFilter to allow SharePoint to index the PDF content. There are a few on the market, some free, some you pay for. In this case the client decided to use the free Adobe PDF iFilter. Not a problem. I installed Adobe Acrobat Reader 9 (which has an iFilter built in) on the SharePoint server, I made a bunch of changes to the registry, I updated Central Admin, I rebooted a half dozen times, I lit incense sticks, performed full indexes another half dozen times yet could still not get PDFs indexed.

Blog post comments indicated that others were experiencing similar issues. The blog article would explain how easy it all was, then a few of the commenters would say that they just could not get it working.

The moment of enlightenment came when I realized that there is a difference between the iFilter built in to the Adobe Reader 9 application and the separate download that Adobe have for the 64-bit PDF iFilter. THAT is what I needed. I was wondering why the installation directory for the Reader was pointing to c:\program files (x86). Sure, this would all work fine on a 32-bit platform, but when you are on 64-bit, then the Reader app won’t cut it no more.

So I uninstalled the Reader app, installed Adobe’s 64-bit iFilter, and Microsoft Bob became my uncle. There is one registry setting that I needed to make (only one)

  1. Launch RegEdit on the SharePoint index server
  2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension
  3. Create a new key called “pdf”
  4. Set the (Default) value for the key to {E8978DA6-047F-4E3D-9C78-CDBE46041603}

If you look at the other registry keys in this section, the (Default) value type should be REG_MULTI_SZ. However, I couldn’t figure out how to change the type for the (Default) value in my new “pdf” key. I got round this by exporting one of the other keys, editing it in Notepad and then importing it. I’m tricky.

Don’t forget that you also need to add the PDF extension to the list of File Types that SharePoint should index. You’ll find this under the management page of the Search Service Application.

I may have restarted the SharePoint Server Search Service (net stop osearch14, net start osearch14), I can’t recall.

After that, just run a full index of your SharePoint 2010 content and you should be good to go. As a side note, I’ve heard that you can’t configure PDF indexing on SharePoint Foundation Server (what you might call WSS 4.0). I haven’t tried, so can’t confirm or deny that.

Tuesday, September 14, 2010

What Content Types are published from the Content Type Hub?

In SharePoint 2010 there is this great new functionality to define a Site Collection as a Content Type Hub. Once you do this, SharePoint will copy any Content Types you declare in this Site Collection out to any other Site Collections that subscribe to the same Managed Metadata Service as the Content Type Hub.

Today a client asked if they can define Content Types at sub-site levels in the Content Type Hub site collection and have them published out. Interesting idea, and there was nothing that confirmed or denied it in the TechNet documentation. So after some testing I can now confirm…that you can’t. Only Content Types defined at the root of the Content Type Hub Site Collection are published out.

Thursday, August 19, 2010

Interactive Pivot of Australia Tech-Ed 2010 Sessions

Going to Tech-Ed in Australia next week? Check out this Microsoft Pivot of the session data, created by MVP Rob Farley:

http://pivot.lobsterpot.com.au/TechEdAU2010/

I’ve been able to quickly filter down to the SharePoint sessions and see who is presenting on what day (fyi – there are 20 Office/SharePoint breakout sessions).

It would be nice if it was easier to get something like the session names for the set of data you are looking at, rather than having to click on each item individually. Still – it’s a nice fast way of browsing a large amount of data.

image

Monday, August 16, 2010

Right Click on a SharePoint 2010 list item

One thing I liked in SharePoint 2007 was the ability to click anywhere along an item’s drop-down field to get at the menu.dropdown I was disappointed to see this removed in SharePoint 2010 – now you have to click on the dropdown list’s down arrow to see the menu.

Sure, it makes sense from a user interface perspective – consistency with standard UI controls and all that. However it was a pain to have to move my mouse those extra few pixels to the right, particularly if the dropdown field is very wide.

Well, I just discovered that you can now right-click anywhere on a list item’s drop down field (except on the text) and you’ll get the drop down menu for the item. This is going to save me so much time!

Thursday, August 05, 2010

Opening a Word document from SharePoint hangs the browser

Here’s an issue that I ran into on a recent project – when I tried to open a document (for editing) from the SharePoint web site, the browser would hang, Word wouldn’t launch and I would have to end up killing the Word and Internet Explorer processes using the Task Manager.

To keep a long, tedious story short, I eventually discovered that the document’s metadata in SharePoint had trailing spaces. Once I removed these, the document opened up just fine. One or two trailing spaces seemed to be fine, but if there was a lot of them, then it caused issues when trying to open the document in Word.

It’s not particularly easy to get trailing spaces into a document’s metadata. If you try to insert them via the browser user interface, SharePoint automatically removes them for you. However, in this project, I was populating the metadata using code. So now I know to use a Trim statement in my code to remove any trailing spaces when updating a SharePoint document’s metadata.

Thursday, June 24, 2010

Shared Service Provider – Access Denied message

Interesting issue I just had with a Shared Service Provider setup that I thought I’d share. After creating the Shared Service Provider, I tried accessing it, but I got the SharePoint “Access Denied” message. I made sure that the account that I was using was a Site Collection Administrator. I also tried giving the account full control via a Web Application Policy. Setting up another account as a site collection admin didn’t work either. No errors or warnings in the Windows Event Logs.

When I created the Web Application for the SSP, I provided an AD account to use for the Application Pool. When I set up the SSP, I specified a different account for the Shared Services Timer Jobs. This is a “best practice” – having different accounts for different jobs.

Looking at IIS, I noticed that the App Pool for my SSP web app was using the SSP Timer Service account. Odd.

I went back and modified the SSP configuration (Central Admin – Application Management – Manage this farm’s Shared Services – Edit Properties) and changed the SSP Service Credentials to the account that I originally specified for the SSP App Pool. I flicked back over to the IIS Management screen to confirm that the Application Pool was now using the account I expected.

I was then able to browse to the SSP admin site. I can’t say I understand why this issue has occurred, but there you have it. I did see a comment about not using the same name for the App Pool and the SSP name which might be the reason for my problem. I’m too lazy to retest right now.

Other related info – my environment is running on Windows 2008 SP2 x64, MOSS 2007 Enterprise with SP 2, using separate servers for AD, SQL and MOSS.

Friday, May 28, 2010

Photos from the Sydney SharePoint User Group Launch

Here are some photos that we took during the Sydney SharePoint User Group 2010 Launch event. We had a packed room, great speakers and cool prizes to give away. Thanks again to Microsoft for letting us use their venue and to AvePoint for the prizes and catering.

Wednesday, May 19, 2010

Got your tickets to Australia’s largest SharePoint Conference?

Only a few weeks to go before the SharePoint Conference kicks off in Sydney. The two day event is on June 16th and 17th at the Hilton Hotel in the city. There are three separate tracks, depending on your interest – Business, Technical and Case Studies.

The Keynote speaker for the event is Arpan Shah, the Director of the SharePoint Technical Product Management team at Microsoft HQ in Redmond. With the recent release of SharePoint 2010, this conference is an ideal place to get up to speed on the new platform and hear real-world stories from companies that use SharePoint on a day-to-day basis

For more details and to register for tickets go to http://www.sharepointconference.com.au/

clip_image001[5]

Tuesday, May 11, 2010

SharePoint 2010 Community Launch Event

The official launch date for Office 2010 and SharePoint 2010 in Australia is Thursday 13th May 2010. In addition to the Microsoft-run events, the SharePoint community is putting on it’s own event in the evening.

There’s going to be prizes (an X-Box 360!), food, drink and some great presentations on the new products. We will also have an Ask The Experts session for you to bring up questions on topics we haven’t covered during the presentations.

This event is going to be held at Microsoft’s offices at 1 Epping Road, North Ryde. You’ll need to register for this no-cost event at the User Group site (http://www.sharepointusers.org.au/sydney).

If you are not based in Sydney, chances are your local SharePoint User Group is planning something Similar. Australian based SharePoint user groups can be found at http://www.sharepointusers.org.au. A special site has been set up for the Australian community launch events at http://www.aunz2010launch.net/ (the site is built on SharePoint 2010!)

You can also check the Twitter feed and hash-tags for this event at http://www.aunz2010launch.net/twitter/

Sunday, May 02, 2010

Moving a Site Collection from Release Candidate to RTM versions

I wasn’t sure if this would be possible, but I can now confirm that you can do a site collection backup on the Release Candidate build (14.0.4730.1010) of SharePoint and restore that it to the RTM (Release to Manufacture) build (14.0.4762.1000).

I used Central Admin to do the site collection backup (a new capability). Then I used the Restore-SPSite powershell command to restore the backup to the new server.

Friday, April 30, 2010

Windows Firewall configuration for SharePoint 2010 install

I’ve just done an installation of the newly released version of SharePoint 2010 and noticed a nice little feature – it configures the Windows Firewall for you automatically, so that you can access your Central Administration site when you are not directly logged on to the server.

In previous versions you had to remember to do this manually. Just a nice little time saver.

Tuesday, April 27, 2010

InfoPath 2010 Developer Reference

Now that Office 2010 has been released, some of the development resources are starting to come out. Here’s one you might have missed – the InfoPath 2010 developer resource. This is a downloadable help file with lots of useful information for people creating more complex forms.

Here is the table of contents:

image

Tuesday, March 23, 2010

Doing SharePoint 2007 Development in Visual Studio 2010

I was recently asked if you could build SharePoint 2007 solutions in Visual Studio 2010. At the time of writing, Visual Studio 2010 is a Release Candidate and will launch in April. I’ve just installed the Release Candidate and I can tell you that there are two SharePoint 2007 project templates included:

  • Sequential Workflow
  • State Machine Workflow

There are no other out of the box 2007 project templates. Of course, there is a rich selection of SharePoint 2010 templates.

While it’s possible that Microsoft may add more SharePoint 2007 templates to the final product, I haven’t been able to find any mention of this in my searches. That doesn’t mean that you can’t use Visual Studio 2010 to create SharePoint 2007 solutions, just that right now you’d have to do a lot of leg work to make it happen.

Fingers crossed that we will see some community extensions (like WSPBuilder and STSDev on Visual Studio 2008) make it easier to use Visual Studio 2010 for SharePoint 2007 targets.

Update: after installing the released version of Visual Studio 2010 Premium, here are the templates that are available to me:

image

Sunday, March 21, 2010

Students get cheap Office

If you are a TAFE or Uni student in Australia, you can now grab a copy of Microsoft Office Ultimate 2007 for only $75 – bargain! For more details go to http://itsnotcheating.com.au

It's Not Cheating

Thursday, March 11, 2010

March Sydney SharePoint User Group

This month’s Sydney SharePoint User Group will be held on Tuesday, 16 March at the Sydney Mechanics School of Arts, 280 Pitt Street.

Since this is the night before Saint Patrick’s Day, we have Miss Ireland coming to present on Lists, Libraries and Content Types – Miss Debbie Ireland that is, New Zealand based SharePoint MVP.

For more details on the session and to subscribe to our mailing list, visit www.sharepointusers.org.au/sydney

Tuesday, February 02, 2010

Australian SharePoint Conference

Here is something for your diaries – the Australian SharePoint Conference will be held at the Hilton hotel in Sydney between June 16 and 17 2010.

This event is being organised by the SharePoint community in Australia and New Zealand. There will be local and international speakers and aims to include a lot of “real world” stories from companies using SharePoint.

You can find out more information at www.sharepointconference.com.au.

Saturday, January 30, 2010

Jobs @ SharePoint Gurus

About two and a half years ago I set up a SharePoint consulting business in Sydney with a colleague of mine. It was a very new experience for me, learning how to run a business in addition to dealing with the technology aspects.

2.5 years down the road and we are still around. In fact, we are now ready to take on the challenge of permanent staff. So if you know someone interested in graduate/junior role in a SharePoint consulting business, ask them to get in touch with us at jobs@sharepointgurus.net.

No SharePoint experience required, but it is an obvious advantage. We are really looking for someone with an aptitude for technology, who enjoys working in an environment where they are constantly learning (and challenged) and has strong written and verbal communication skills. An IT degree won’t hurt, but its not essential.

Monday, January 25, 2010

You can never have enough reading material

I just discovered this handy page that lists all of the SharePoint articles published on the MSDN Magazine site. As of today, there were 29 different articles, spanning SharePoint 2001 through to SharePoint 2010. That should keep you off the streets for a while:

http://msdn.microsoft.com/en-us/magazine/ee532094.aspx?sdmr=sharepoint&sdmi=topics