Configure My Alerts with multiple Workspaces

Overview

iShare may be configured for multiple Workspaces / Languages. The default installation of the MyAlerts console takes no account of Workspaces. Emails will be sent to all users and all emails will use the default template file. For instance, if you have CouncilA and CouncilB Workspaces this is a problem. While members of the public that have subscribed to CouncilB alerts will only get the alerts they expect, they will most probably be in CouncilA themed emails (if not, then vice versa). 

Step-by-step guide

Step 1 - Check Account details have been enabled

First you need to un-comment the account details for the "MyALertsService" in atAppConfig.xsl which you will find in the following location:

D:\Astun\Share\n.n\WebApps\WebService\xml\atAppConfig.xsl

Open the file using a Text Editor such as Notepad++ and scroll down to the "MyAlertsService" section as outlined below. You should see the Account details commented out. These are used to authenticate with the My Alerts Web Services and may already be enabled. Note that there is no need to change any of the credentials in this section.

MyAlertsService
	<xsl:template match="MyAlertsService" priority="100">
		<MyAlertsService>
			<xsl:if test="self::node()[@enabled]">
				<xsl:attribute name="enabled">
					<xsl:value-of select="@enabled" />
				</xsl:attribute>
			</xsl:if>
			<Debug>
				<xsl:if test="Debug[@enabled]">
					<xsl:attribute name="enabled">
						<xsl:value-of select="Debug/@enabled" />
					</xsl:attribute>
				</xsl:if>
				<xsl:copy-of select="Debug/CacheFile" />
				<xsl:copy-of select="Debug/Compare" />
				<xsl:copy-of select="Debug/Console" />
				<xsl:copy-of select="Debug/SnapFile" />
			</Debug>
			<!--xsl:copy-of select="DSN" /-->
			<xsl:copy-of select="AppPath" />
			<xsl:copy-of select="ServicePath" />
			<xsl:copy-of select="ChangePasswordURL" />
			<xsl:copy-of select="DefaultURL" />
			<Exceptions>
				<xsl:copy-of select="Exceptions/Reporting" />
				<xsl:copy-of select="Exceptions/IncludeStack" />
			</Exceptions>
			<Email>
				<xsl:copy-of select="Email/CC" />
				<xsl:copy-of select="Email/To" />
				<xsl:copy-of select="Email/Content" />
				<xsl:copy-of select="Email/Subject" />
				<xsl:copy-of select="Email/From" />
				<xsl:copy-of select="Email/TemplateFile" />
				<xsl:copy-of select="Email/ReportTo" />
				<ForgotPassword>
					<xsl:copy-of select="Email/ForgotPassword/Subject" />
					<xsl:copy-of select="Email/ForgotPassword/Addendum" />
				</ForgotPassword>
				<Register>
					<xsl:copy-of select="Email/Register/Subject" />
					<xsl:copy-of select="Email/Register/Addendum" />
				</Register>
				<Showing>
					<xsl:copy-of select="Email/Showing/Exceeded" />
					<xsl:copy-of select="Email/Showing/Multi" />
					<xsl:copy-of select="Email/Showing/Single" />
				</Showing>
			</Email>
			<xsl:copy-of select="SpatialFields" />
			<xsl:copy-of select="GloblaSpatial" />
			<xsl:copy-of select="IgnoredFields" />
			<xsl:copy-of select="URL" />
			<xsl:copy-of select="MaxLayerChanges" />
			<xsl:copy-of select="MyAlertsWebServiceURL" />
			<xsl:copy-of select="MyHouseSource" />
			<xsl:copy-of select="Notify" />
			<!--Account>
				<xsl:copy-of select="Account/Username" />
				<xsl:copy-of select="Account/Password" />
				<xsl:copy-of select="Account/Key" />
			</Account-->
			<xsl:copy-of select="TransactionWebServiceURL" />
			<xsl:copy-of select="UserManagerWebServiceURL" />
			<xsl:copy-of select="UsersWebServiceURL" />
			<xsl:copy-of select="XSLFile" />
			<xsl:copy-of select="OldInterface" />
			<xsl:copy-of select="ResetKeyValidityTime" />
		</MyAlertsService>

Remove the comment so that the Account entries read as follows:

			<Account>
				<xsl:copy-of select="Account/Username" />
				<xsl:copy-of select="Account/Password" />
				<xsl:copy-of select="Account/Key" />
			</Account>

Step 2 - Override specific My Alerts configuration details for a Workspace

As with other iShare Settings for Workspaces, you may override any of the My Alerts Settings such as the Style Sheet and Email settings as shown in the example below, by adding an entry into the iShareMaps.xml file, which may be found in the \webapps\webservice\config folder, under the ConfigurationDefinition node. 

<Workspace name="councila" lang="LangTesting">
     <ConfigurationDefinition>
       <MyAlertsService>
            <XSLFile>xml\myHousev3.3.xsl</XSLFile>
            <Email>
                <From>Council A admin</From>
                <Subject>There have been changes around your house.</Subject>
                <TemplateFile>D:\Astun\MyAlerts Console\Config\template.htm</TemplateFile>
            </Email>
       </MyAlertsService>
       <Web>
         <CookieHost>JLT2008</CookieHost>
         <Content>
           <Welcome>atWelcomeCouncilA.aspx</Welcome>
         </Content>
         <URL>http://JLT2008/councila.iShareMaps.Web/</URL>
       </Web>
     </ConfigurationDefinition>
...
</Workspace>

Step 3 - Specify the Workspace parameter when running the My Alerts Console

The My Alerts Console is generally run via a Workflow Program Task without any additional parameters. If you have configured iShare to use Workspaces then you must specify the -workspace parameter in the Additional parameters box e.g.

Step 4 - Ensure configuration file has been amended

The Astun.MyAlerts.Console.exe.config must be amended so that iShareConfig is set to a url rather than a file path:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <!-- Config file to use for most settings-->
    <!-- <add key="iShare.config" value="D:\Astun\iShare\LIVE\Settings.xml" /> -->
    <!-- Config file for workspaces-->
    <add key="iShare.config" value="http://localhost:81/iShareLIVE.WebService" />
  </appSettings>
</configuration>