Estender a barra do tempo no Outlook

Learn how to plug in a third-party weather web service for the Weather Bar in Outlook 2013, to provide weather conditions data for a user-chosen location.

Visão geral sobre a Barra do Tempo

The Weather Bar in Outlook displays weather conditions and forecast for a geographic location. A user can choose one or multiple locations, and conveniently see weather data in the Weather Bar in the calendar module. Figure 1 shows the Weather Bar displaying a three-day forecast for New York, NY.

Figura 1. Barra do Tempo no Outlook

Barra do tempo mostrando a previsão de Nova York.

Settings for the Weather Bar are saved with the user's profile. Depending on the type of Outlook account, the settings may roam with the user on all computers that the user logs on to with the same profile, as in the case of Exchange accounts. Alternatively, the user can customize settings on each computer, as in the case of IMAP/POP accounts.

By default, Outlook uses weather data provided by MSN Weather. The Weather Bar supports third-party weather data web services that follow a defined protocol to communicate with Outlook. As long as a third-party weather data service supports this protocol, users can choose that weather data service to provide weather data in the Weather Bar. This article describes the protocol for third-party weather services to integrate with Outlook in the Weather Bar.

Weather Bar protocol

A user can specify a different weather data service for the Weather Bar, as long as that weather data service implements a web service that supports the following protocol to communicate with Outlook:

  1. The weather data service supports a base URL to a web service. For example, a Contoso Weather web service can have a base URL of https://service.contoso.com/data.aspx.

  2. O serviço Web permite que o Outlook acrescente os seguintes parâmetros ao URL de base, para solicitar um código de local:

    • outputview=search: esse parâmetro indica que a solicitação é uma pesquisa de local.

    • weasearchstr= city: este parâmetro indica a localização, cidade, para a qual o usuário deseja uma previsão meteorológica (por exemplo, Londres).

    • culture= LCID: esse parâmetro indica a cultura da versão do Office instalado para o usuário no computador. O valor de LCID é definido em [RFC4646] Marcas para identificar linguagens

    • src=outlook: esse parâmetro indica que o Outlook é o aplicativo cliente que está solicitando o serviço.

    These parameters allow Outlook to take the location that the user is interested in and search for the associated location code as supported by the weather data service. The web service should respond to Outlook with a location code in XML that follows the Outlook Weather Location XML Schema. Figure 2 summarizes the web service request and response for a location code.

    Figura 2. Solicitação e resposta do serviço Web para um código de localização

    Weather location request and response

  3. O serviço Web também permite que o Outlook acrescente os seguintes parâmetros, para solicitar informações de previsão para um código de local:

    • wealocations= code: code nesse parâmetro é um código de local que o Outlook obtém da Etapa 2 e que mapeia para o local em que o usuário está interessado.

    • weadegreetype= degreetype: esse parâmetro especifica se serão usadas unidades de medida métricas ou imperiais para a temperatura. Especifique c para métrica, f para imperial para degreetype. Esse parâmetro é opcional e não está sempre presente na solicitação de serviço Web.

    • culture= LCID: esse parâmetro indica a cultura da versão do Office instalado para o usuário no computador. O valor de LCID é definido em [RFC4646] Marcas para identificar linguagens

    • src=outlook: esse parâmetro indica que o Outlook é o aplicativo cliente que está solicitando o serviço.

    These parameters allow Outlook to take the location code returned from Step 2 and request the weather data service for the forecast. The web service should respond to Outlook with the corresponding weather data in XML that follows the Outlook Weather Information XML Schema. Figure 3 summarizes the web service request and response for weather data given a location code.

    Figura 3. Solicitação e resposta do serviço Web para informações meteorológicas

    Weather information request and response

Setting the Weather Bar to use a weather service

The administrator or power user can use the WeatherServiceUrl registry key to customize the Weather Bar to use a specific weather service. For example, if the base URL for a Contoso weather service is https://service.contoso.com/data.aspx, you can set the WeatherServiceUrl key to that URL.

The following table describes the WeatherServiceUrl key.

Valor Descrição
Key
HKCU\Software\Microsoft\Office\15.0\Outlook\Options\Calendar
Value name
WeatherServiceUrl
Value type
REG_SZ
Default value
EMPTY_STRING
Descrição
URL to a weather data service.

Dependent conditions

Outlook 2013 displays the Weather Bar by default. This section describes a few reasons why the Weather Bar might not be visible.

Weather Bar is disabled

First, verify that Show weather on the calendar is selected in the Calendar tab in the Outlook Options dialog box.

Note that an administrator can also use Group Policy to disable the Weather Bar in Outlook 2013 entirely by setting the following key in the Windows registry:

Valor Descrição
Key
HKCU\Software\Microsoft\Office\15.0\Outlook\Options\Calendar
Value name
DisableWeather
Value type
REG_DWORD
Default value
0
Descrição
A value of 0 enables the Weather Bar; any other value disables the Weather Bar.

If the Weather Bar feature has been disabled by Group Policy, the Calendar tab does not include the Show weather on the calendar check box. Consult with the administrator to turn the feature back on.

Office is disconnected from the Internet

Verify that Office is enabled to connect to the Internetgo to the Privacy options tab of the Trust Center in the Backstage view, and ensure that Allow Office to connect to the Internet is selected.

If the user has chosen to not receive updates for Office, the Weather Bar is also disabled.

An administrator can also use Group Policy to disable all online content, including the Weather Bar, by setting the following key in the Windows registry:

Valor Descrição
Key
HKCU\Software\Microsoft\Office\15.0\Common\Internet
Value name
UseOnlineContent
Value type
REG_DWORD
Default value
2
Descrição
A value of 2 enables the Weather Bar; any other value disables the Weather Bar.

If the Weather Bar feature has been disabled by Group Policy, the Calendar tab does not include the Show weather on the calendar check box. Consult with the administrator to turn the feature back on.

Weather Bar example

This section shows an example of a Contoso Weather service that follows the preceding protocol to communicate with Outlook. For any location that the user selects, Outlook first gets a location code for that location from Contoso Weather, then using that location code, calls the Contoso Weather service to get the weather data.

Base URL

Contoso Weather provides the following base URL for their weather data service:

https://service.contoso.com/data.aspx

Getting a location code

O Outlook acrescenta os parâmetros descritos na Etapa 2 acima à URL base para obter o código de localização de uma cidade de localização geográfica:

https://service.contoso.com/data.aspx?outputview=search&cidade de weasearchstr=

As an example, if the user has selected Tokyo in the Weather Bar, Outlook uses the following URL to obtain the location code for Tokyo from Contoso Weather:

https://weather.service.contoso.com/data.aspx?outputview=search&weasearchstr=tokyo

Contoso Weather responds with the following XML to provide the location code for Tokyo. The XML conforms to the Outlook Weather Location XML Schema. Note that it is common for weather services to return data for more than one location (for example, if the selected location is a greater metropolitan area). In this example, the response for Tokyo includes two locations, each enclosed in a weather element. The corresponding location codes are as follows:

  • wc:JAXX0085 para o atributo weatherlocationname sendo Tokyo, JPN

  • wc:10038604 para o atributo weatherlocationname sendo Shinjuku-ku, Tokyo, Japan

<?xml version="1.0" ?>
<weatherdata>
  <weather weatherlocationcode="wc:JAXX0085" 
    weatherlocationname="Tokyo, JPN">
  </weather>
  <weather weatherlocationcode="wc:10038604" 
    weatherlocationname="Shinjuku-ku, JPN">
  </weather>
</weatherdata>

Getting weather information for a location code

After obtaining the location code for a location, Outlook appends the parameters described in Step 3 above to the base URL to obtain weather information for that location code.

https://service.contoso.com/data.aspx?wealocations= Código

As an example, if Outlook has obtained the location code wc:JAXX0085 from Contoso Weather for Tokyo, Outlook uses this location code in the following URL to get the weather information.

https://service.contoso.com/data.aspx?wealocations=wc:JAXX0085

Contoso Weather responds with the following XML to provide the weather information for the location code for Tokyo. The XML conforms to the Outlook Weather Information XML Schema.

<?xml version="1.0"?>
<weatherdata>
  <weather timezone="9" attribution="Data provided by Trey Research" 
    degreetype="F" imagerelativeurl="https://contoso.com/images/" 
    url="https://contoso.com/weather.aspx?eid=33568&amp;q=Tokyo-JPN" 
    weatherlocationname="Tokyo, JPN" 
    weatherlocationcode="wc:JAXX0085">
      <current winddisplay="9 mph NNW" windspeed="9" humidity="90" feelslike="44" 
        observationpoint="Tokyo" observationtime="06:00:00" 
        shortday="Sat" day="Saturday" date="2012-04-14" skytext="Rain" skycode="11" 
        temperature="48"/>
      <forecast shortday="Sat" day="Saturday" date="2012-04-14" precip="95" skytextday="Rain"
        skycodeday="11" high="55" low="47"/>
      <forecast shortday="Sun" day="Sunday" date="2012-04-15" precip="5" skytextday="Partly Cloudy" 
        skycodeday="30" high="65" low="43"/>
      <forecast shortday="Mon" day="Monday" date="2012-04-16" precip="5" skytextday="Partly Cloudy" 
        skycodeday="30" high="64" low="52"/>
      <forecast shortday="Tue" day="Tuesday" date="2012-04-17" precip="70" skytextday="Showers / Clear" 
        skycodeday="39" high="66" low="53"/>
      <forecast shortday="Wed" day="Wednesday" date="2012-04-18" precip="55" skytextday="Showers / Clear" 
        skycodeday="39" high="68" low="51"/>
  </weather>
</weatherdata>

Resetting Outlook to use MSN Weather

Even though Outlook uses MSN Weather by default, if a user has customized the Weather Bar to use a different weather service and subsequently wants to use MSN Weather again, the user can simply delete the WeatherServiceUrl key in the Windows Registry. Deleting that registry key resets Outlook to use MSN Weather.

Conclusão

The Weather Bar in the Outlook calendar uses MSN Weather by default to provide the weather forecast for a specified location. Users can conveniently see weather information for the locations they care about. Third-party weather data services can also integrate with the Weather Bar by supporting the Outlook Weather Location XML Schema and Outlook Weather Information XML Schema and following a simple web service protocol with Outlook.

Confira também