RDOWeatherLocation object

 

RDOWeatherLocation object represents a particular location with a name and a unique code.

The weather conditions at that location can be retrieved by calling the GetCurrentConditions method (returns RDOWeatherConditions object).

 

Returned by:

RDOWeatherServices.SelectedLocation

 

See also: RDOWeatherServices, RDOWeatherLocations, RDOWeatherConditions, RDOWeatherForecastCollection, RDOWeatherForecast

 

The example below displays all weather locations from the default store.

'enumerate all existing weather locations

set Session = CreateObject("Redemption.RDOSession")

Session.MAPIOBJECT = Application.Session.MAPIOBJECT

for each objLocation in Session.WeatherServices.Locations

  Debug.Print objLocation.Name & " - " & objLocation.Code

next

 

Properties

Methods

 


Derived from: IDispatch


Properties


Code Returns the unique code of the location (e.g. "wc:USAZ0166").
String, read/write.
 
Name Returns the name of the location (e.g. "Phoenix, AZ").
String, read/write.
 

Methods


Delete Deletes the location from its parent RDOWeatherLocations colleciton.
 
GetCurrentConditions Returns the RDOWeatherConditions object representing the current weather conditions at the location.

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