set
Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set
CurrentUser = Session.CurrentUser
strCity = CurrentUser.City
if
strCity <>
""
Then
'we need to have at least the city for the weather
strState =
CurrentUser.StateOrProvince
strCountry =
CurrentUser.Country
strLocation = strCity
if
strState <>
""
Then
strLocation = strLocation &
", "
& strState
if
strCountry <>
""
Then
strLocation = strLocation &
", "
& strCountry
set
WeatherServices = Session.WeatherServices
set
locations = WeatherServices.ResolveLocation(strLocation)
if
locations.Count = 0
Then
MsgBox
"Unable to resolve location "
& strLocation
Else
'todo: check if there is more than one match
set
objLocation = locations(1)
'if the location is not yet added to list of locations in the current
mailbox,
'add it (but we don't have to do that)
if
(WeatherServices.Locations.Item(objLocation.Code)
Is
Nothing)
Then
WeatherServices.Locations.Add(objLocation)
WeatherServices.Save
End
If
'display the current weather for the mailbox owner
set
CurrentConditions = objLocation.GetCurrentConditions
strCurrentWeather =
"Weather for "
& CurrentConditions.LocationName & vbCrLf & _
"Temperature: "
& CurrentConditions.Temperature & vbCrLf & _
"Wind: "
& CurrentConditions.WindDisplay & vbCrLf & _
CurrentConditions.SkyText & vbCrLf
for
each
objForecast
in
CurrentConditions.Forecast
strCurrentWeather = strCurrentWeather & vbCRLF & _
objForecast.Day &
" ("
& objForecast.Date &
")"
& _
". Low: "
& objForecast.Low & _
", High: "
& objForecast.High &
", "
& _
objForecast.SkyText
next
MsgBox
strCurrentWeather
End
If
End
If
|