Thursday, October 23, 2008

Including XML in your Blog posts

I was looking for a way to post XML in my Blog posts.

Here is the solution: http://www.elliotswan.com/postable/

When you first hit the page you may think that the page didn't load properly. But what you actually need to do is:
Copy and paste your xml into the area under "For your copy-and-pasting pleasure" then click the "make it friendly".

Then you can copy and paste resulting text in your blog posts.

Great work Elliot!

Sharepoint & Melbourne Daylight Savings

I'm currently experiencing an issue where the Sharepoint timer service is kicking off an hour early. My network infrastructure people have assured me that they've installed all the service patches for all the servers.

A colleague found this MS KB Article: http://support.microsoft.com/kb/888253

And it seemed to be the solution. But when I checked my TIMEZONE.XML file the Daylight saving date appears to be correct:

<DaylightTime>
<Bias>-60</Bias>
<Date>
<Month>10</Month>
<Day>5</Day>
<Hour>2</Hour>
</Date>
</DaylightTime>

That is the correct date and time for Melbourne (this year) as per this page.

FYI I'm on the MOSS and upto version 12.0.0.6318 (Infrastructure update).

Chris Armstrong has also blogged about this yesterday (darn beat me by one day) but the daylight saving start date he uses don't appear to be correct. I'll make another post once I have a solution.

Wednesday, October 15, 2008

Running javascript after window.onload without breaking Sharepoint

If you're anything like me and are working with a lot of Javascript within Sharepoint. You will eventually need to run a script after the page loads. So you could add defer="defer" to your script tag, which sometimes works and sometimes doesn't.

You might be tempted to window.onload = someFunction(). But this will break the way Sharepoint load's it's pages. As Sharepoint also needs to do a lot of things after the page loads.

So the solution is:
window.attachEvent("onload", someFunction);

So instead of overriding the onload event. You are now adding an event to the queue. Simply replace the "someFunction" bit with your function name.

Sunday, October 5, 2008

Create a new form in Infopath without opening up a Form Library

I found this post and I thought it was really neat. Basically you can create a link anywhere in Sharepoint that creates a new form in Infopath without prompting the user for the "Open, Save As, Cancel" prompt. All you have to do is put this on your page. Change YOURSEVER with your server name, SITE to your site(s) name and FORM LIBRARY with your form libary name:

<a href="javascript:createNewDocumentWithProgID(
escapeProperlyCore('http://YOURSERVER/SITE/FORM LIBRARY/Forms/template.xsn', true),
'http://YOURSERVER/SITE/FORM LIBRARY/',
'SharePoint.OpenXMLDocuments',
true)">Create a New Document</a>

Monday, September 29, 2008

SPS 2003 Alerts

My company is using SPS2003 and I have been told that alerts never really worked properly before. So I started to investigate. I found this article http://wss.collutions.com/Lists/FAQ/DispForm.aspx?ID=198

All the accounts had the correct permissions so I started to check the indexing schedules. I found that who ever setup SPS prior to my arrival had set the "Task interval" to 15 minutes and the "Task duration" to only 20 minutes.

The problem here is the Task duration isn't referring to the amount of time for the task to complete. But for how long during the day (in my case) the task will run.

For example if you want the incremental indexing to run every 15 minutes between the hours of 9am to 5pm then these are the settings you should have:
Schedule type: Daily
Starting time; 9:00 AM
Repeat task: yes
Task interval: 15
Task duration: 480
Schedule interval: 1

To get to the page where you can set these settings:
Portal home page > Site Settings > Search Settings and Indexed Content > Configure search and indexing > Manage search schedules
You then need to select the relevant search schedule and check the settings.

I hope this helps out someone out there.

Sunday, September 21, 2008

Patrick Tisseghem's Passing

If you've got anything to do with Sharepoint development you've surely heard that Patrick passed away on 3rd Sept 2008.

Isn't it strange how we can mourn a loss of someone who we've never met? But I feel that the Sharepoint community has suffered a great loss.

Although I've never met the man I feel that he was the type of guy who would not have regrets and would have lived life to the fullest.

This is a reminder to all of us that we are only here for a limited amount of time. We should ensure the time we spend on this earth is spent well and to the benefit of the community as a whole. Which I think Patrick has achieved with his work.

Patrick you will be missed by all.

HTTP Error 401.2 after SPS 2003 deployment

I'm in the process of creating a development server to mirror my production server. After deploying SPS2003 I attempted to browse to http://localhost/default.aspx and got: " HTTP Error 401.2 - Unauthorized: Access is denied due to server."

After a little Googling I found this post.

Basically you need to check that "Integrated Windows authentication" is enabled for your Web site in IIS.

Monday, September 8, 2008

Sharepoint solution file error

I tried to run the following command:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o addsolution -filename ChansFunkyFeature.wsp

And got this:
Object reference not set to an instance of an object.
ChansFunkyFeature.wsp: The Solution installation failed.

I found this was caused by me not having the right permissions to add this solution file to sharepoint.

To resolve:
Click "Start"
Right click on "Command Prompt".
Click "Run as..."
Enter in credentials for a user who does have access to add the solution to your sharepoint environment.

*For you console types:
runas /profile /user:putYourDomainHere\putUsernameHere CMD

Enjoy.

Wednesday, July 16, 2008

WSS 3.0 / MOSS Region settings

I'll get straight to it. If you live outside of the US you may have noticed that your WSS 3.0 / MOSS server maybe defaulted to the US region settings. Diplaying dates in the mm/dd/yyyy format. Being an Aussie we like our dates in the dd/mm/yyyy format. After a bit of poking around I found this.

You can change this by going to this layout page: http://sharepointServer:22335/_layouts/regionalsetng.aspx

Obviously change your server name and port number. This can also be done for your Central Admin.

Wednesday, July 9, 2008

Sharepoint Solution Deployment Failure

Hi everyone,
I came across an issue where a Sharepoint solution failed to complete it's deployment. Leaving me in a state where I had no options, only an error message in Central admin:


I found this post. But that didn't help me.

What did help were these two STSADM commands:
STSADM -o enumdeployments
STSADM -o canceldeployment -id *your guid here*

Get the ID from the first command and place it into the
*your guid here* bit.

This is just a clean up. Not a fix. But it's better than leaving something in a stuck state.

Good luck!

-Chan

Sunday, June 15, 2008

Embedding a resource in your ASP.NET 2.0 assembly

While developing a web part for Sharepoint I came across an issue where I needed to have Javascript manipulate elements in the web part. I searched around for the best way to include my Javascript file as part of my Sharepoint solution and came across many articles but I couldn't get their methods to work until I came across this one:
http://www.codeproject.com/KB/aspnet/MyWebResourceProj.aspx

I'm not sure why but "Page.ClientScript.GetWebResourceUrl" seems to work for me but "Page.ClientScript.RegisterClientScriptResource" as per this article doesn't.

Wednesday, June 11, 2008

Dynamically set the onclick attribute of a html element using Javascript

I've been trying to dynamically set the onlick attribute of a span element in Javascript.
I tried a couple of things including:
var newNavNode = document.createElement("span");
newNavNode.onclick = "horizontalNavClick('"+nodeValue+"');" ;

But this wasn't working as a reference to the function was needed and not a string.

I googled and found this post: http://codingforums.com/archive/index.php?t-55356.html

And modified my script to:
var newNavNode = document.createElement("span");
newNavNode.onclick = new Function("horizontalNavClick('"+nodeValue+"')");

This worked like a charm. Thanks Willy Duitt!

Happy scripting everyone!

Monday, May 19, 2008

Contact Selector in Infopath 2007

First post on my new blog. Yay! Ok after a lot of poking around I found a few articles which appear to have stemed from the Infopath Team Blog The articles seemed promissing enough. So I started up Infopath 2007 and followed the instructions. I stumbled in two places and this is why I'm writing this post. Firstly when you create your Context.xml you also need to specify the port number if you are using one.
If you don't have a correct server name or don't specify the correct port number you'll simply get:








So if you get this message and you know there's a "smith" in your AD somewhere then check that you have the correct server address specified in your Context.xml file.
After I fixed up that issue I was puzzled by the strange behaviour that I was getting out of the control. After typing in a name and clicking the "check name" button the control would become disabled. The same would happen when I selected a person from the list.

I scratched my head and read over the instructions again. I noticed that one of the instructions mentioned that you should drag the
group onto the design surface. Where I had been dragging the repeating field (Person) onto the designer. I should have been dragging the People group on.


I hope this post will save some you some time. Isn't that what it's all about?