This JavaScript object is written into each page, and contains useful information about that page. For my requirement, the _spPageContextInfo.siteServerRelativeUrl property contains the value I needed.
Sunday, April 10, 2011
Finding the SharePoint Site Collection URL on the Client
Little tip - if your client-side code needs to know the URL of the site collection hosting a SharePoint page, have a look at the properties of the _spPageContextInfo object in the HTML source of the page.
Simple Glossary App (Beta) for SharePoint Released
Have just published details of a new simple glossary/theasaurus application for SharePoint - OneStride Define. The idea behind this, and other layers planned for the framework, is to offer a way to layer interactivity and information on top of existing SharePoint pages.
No need to modify pages that already refer to a word that needs to be clearly defined - just add that word to a dedicated list in SharePoint, and any occurrence of that word in published pages or text fields in lists will be linked to the definition. Nice n' simple.

An additional benefit is that the framework and this first "layer" are supplied as sandboxed solutions, meaning that they can be deployed through the browser, run isolated from the rest of SharePoint and are suitable for use in hosted SharePoint (Office 365 here we come!).
This beta will be available until the end of May 2011. Have a look and let me know what you think!
No need to modify pages that already refer to a word that needs to be clearly defined - just add that word to a dedicated list in SharePoint, and any occurrence of that word in published pages or text fields in lists will be linked to the definition. Nice n' simple.

An additional benefit is that the framework and this first "layer" are supplied as sandboxed solutions, meaning that they can be deployed through the browser, run isolated from the rest of SharePoint and are suitable for use in hosted SharePoint (Office 365 here we come!).
This beta will be available until the end of May 2011. Have a look and let me know what you think!
Wednesday, March 2, 2011
Help for Businesses in Quake-striken Christchurch, NZ
Am gathering links to sites and pages dedicated to assisting businesses in recovering and rebuilding in Christchurch, New Zealand - the page is at http://www.smallsteps.co.nz/restart.aspx . If you find any other sites that are of value to our businesses, please let me know through a comment to this post.
If you are interested in seeing Twitter in action in an event like this, search for tweets containing #eqnz.
If you are interested in seeing Twitter in action in an event like this, search for tweets containing #eqnz.
Monday, December 20, 2010
JSON, jQuery, IE, OData and a Parsererror
Quite a collection of technologies and approaches in that combination being used on a single page in SharePoint - mostly worked fine until I had deployed to a site using IE7. Suddenly my jQuery calls to $.getJSON() would silently fail, and with no error callback on the getJSON method, I resorted to an $.ajax call instead.
Experimenting in the error callback, found that even though the response status was success, there was an error - the error text was "parsererror". Seems that IE7's native parsing of JSON does behave too well for jQuery 1.4.2. Finally wrote some code in the error callback to detect when the err was parsererror, and in that instance to create a new JSON object using eval, similar to this:
$.ajax({
type: 'GET',
url: serviceUrl,
contentType: 'application/json: charset=utf-8',
dataType: "json",
success: ProcessResults,
error: function (xhr, textStatus, errThrown) {
if (textStatus == 'parsererror') {
var json;
try { json = eval('(' + xhr.responseText + ')'); }
catch (e) { }
ProcessResults(json);
}
}
});
After working out this fix, I found some information on stackoverflow suggesting that IE has problems with leading new line characters at the start of the JSON in the HTTP response body.
Experimenting in the error callback, found that even though the response status was success, there was an error - the error text was "parsererror". Seems that IE7's native parsing of JSON does behave too well for jQuery 1.4.2. Finally wrote some code in the error callback to detect when the err was parsererror, and in that instance to create a new JSON object using eval, similar to this:
$.ajax({
type: 'GET',
url: serviceUrl,
contentType: 'application/json: charset=utf-8',
dataType: "json",
success: ProcessResults,
error: function (xhr, textStatus, errThrown) {
if (textStatus == 'parsererror') {
var json;
try { json = eval('(' + xhr.responseText + ')'); }
catch (e) { }
ProcessResults(json);
}
}
});
After working out this fix, I found some information on stackoverflow suggesting that IE has problems with leading new line characters at the start of the JSON in the HTTP response body.
Thursday, December 9, 2010
SharePoint Designer and generate-id
Just wanted to note down a great tip from Marc D Anderson (who derived the idea from a post by Jorge Vasquez) on how to work around the annoyance of SharePoint Designer 2007 inserting generate-id() statements into the ID attributes of HTML tags in customised XSL in SharePoint 2007 or WSS3 pages.
The small steps to applying this fix are as follows:
1. Create an empty dummy variable in the XSL , for example
<xsl:variable name="DummyVar">
2. Append this dummy parameter to any IDs, e.g.
<input id="myid{$DummyVar}" type=......
The small steps to applying this fix are as follows:
1. Create an empty dummy variable in the XSL , for example
<xsl:variable name="DummyVar">
2. Append this dummy parameter to any IDs, e.g.
<input id="myid{$DummyVar}" type=......
Thursday, October 14, 2010
WCF Data Service "Could not load file or assembly App_Web" Error
The "Could not load file or assembly App_Web_" error was showing sporadically on a small test WCF Data Service site.
In my first attempt to solve the issue, I deleted all files in the site, and copied the site files from a deployment package. The data service magically started working.
Later in the day, the same error returned. After researching on the web, came across one lead that suggested deleting all the ASP.Net temporary files. Other posts mentioned issues with compilation. Therefore, as an experiment I adjusted the Web.Config file of the site so that the Compilation node had the following attributes:
debug="false" batch="false"
And this seems to have solved the issue for me - I think each recycle of the Application Pool was causing an attempt to recompile, which was failing for some reason. Probably relates to the other post with regard to some issue around the ASP.Net temporary files folder.
Batch compilation isn't really necessary for this small app, so game over!
In my first attempt to solve the issue, I deleted all files in the site, and copied the site files from a deployment package. The data service magically started working.
Later in the day, the same error returned. After researching on the web, came across one lead that suggested deleting all the ASP.Net temporary files. Other posts mentioned issues with compilation. Therefore, as an experiment I adjusted the Web.Config file of the site so that the Compilation node had the following attributes:
debug="false" batch="false"
And this seems to have solved the issue for me - I think each recycle of the Application Pool was causing an attempt to recompile, which was failing for some reason. Probably relates to the other post with regard to some issue around the ASP.Net temporary files folder.
Batch compilation isn't really necessary for this small app, so game over!
Sunday, October 10, 2010
Web Application with Host Header on Port 80 Fails
Adding new SharePoint web applications on port 80 is easy by associating a host header name, but I was unable to view the site collection in the new web application with IE - the login dialog box would show three times, and then just a blank page, even though my account was the primary site collection administrator.
Turns out that in Windows 2008 R2 it is necessary to disable the loopback check. Open the Powershell ISE or console (as administrator to get sufficient registry permissions!) and run the following script:
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -value "1" -PropertyType dword
Thanks to Ignacio Montenegro of IGA Systems for that tip.
Turns out that in Windows 2008 R2 it is necessary to disable the loopback check. Open the Powershell ISE or console (as administrator to get sufficient registry permissions!) and run the following script:
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -value "1" -PropertyType dword
Thanks to Ignacio Montenegro of IGA Systems for that tip.
Subscribe to:
Posts (Atom)