June 21, 2012

Resolving the g_instanceId undefined error in Meeting Workspaces

If you’re utilizing a custom master page derived from the OOTB v4.master page, you’ll probably notice Re-occurring meeting work spaces begin to fail when trying to navigate between dates of said workspace.  To reproduce the problem, simply create a calendar, add a re-occurring event to the calendar and choose the option to use a meeting workspace to manage the events.  Click through to the workspace and then use the date navigation in the left hand side navigation bar… If you haven’t implemented the fix below, you will see a JavaScript ‘g_instanceId is undefined’ or similar error.




To resolve, there are two solution,

1) Edit your custom masterpage and add the ‘Meetings’ Tag Prefix below the ‘Microsoft.SharePoint’ namespace import declaration as per below

<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="Meetings" Namespace="Microsoft.SharePoint.Meetings"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

then, simply add the meetings ‘PropertyBag’ web control directly after the opening tag:

<body scroll="no" onload="if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();" class="v4master">
<Meetings:PropertyBag ID="PropertyBag1" runat="server"/>

Package and redeploy…

2)  There are many cases where developer does not have access to master page, so this is not fix, but a work around.

Add HTML Web part Page and paste following script in it,
<Script language="JavaScript">
function MtgNavigate(a)
{
window.location.href="[siteurl]/default.aspx?InstanceID="+a
}
</Script>

When we click on any dates in Meeting workspace, it will call MtgNavigate() with the selected date as in parameter, so we have to just redirect with the URL parameter, and its done.

Enjoy, if any one have any other solution, please send to us or publish.