IUccPresenceContactCardAddress.State Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Gets and sets the state or province of the contact.

Namespace: Microsoft.Office.Interop.UccApi
Assembly: Microsoft.Office.Interop.UccApi (in microsoft.office.interop.uccapi.dll)

Syntax

'Declaration
Property State As String
string State { get; set; }
property String^ State {
    String^ get ();
    void set (String^ value);
}
/** @property */
String get_State ()

/** @property */
void set_State (String value)
function get State () : String

function set State (value : String)

Property Value

A value of the BSTR* (string, for a .NET application) type. An example of the State value is "Washington" or "WA".

Remarks

Win32 COM/C++ Syntax

HRESULT get_State
(
   BSTR* pbstrState
);
HRESULT put_State
(
   BSTR pbstrState
);

Note

In a Win32 application, the return value of a method or property is always an HRESULT value indicating the status of the call to the interface member. Any result of the operation is returned as a parameter marked with the [out, retval] attribute. In contrast, in a .NET application the HRESULT value indicating an error condition is returned as a COM exception and the [out, retval] parameter becomes the return value. For the UCC API-defined HRESULT values, see Trace and Handle Errors in Unified Communications Client API.

Example

The following example returns a state name for an IUccPresenceContactCardAddress instance of a given type. If the state name parameter is not null, the example sets a new state name string. These example methods are drawn from a client application class that wraps an instance of IUccPresenceContactCardInstance (this._ContactCard).

/// <summary>
/// returns the state of the contact card for a given
/// address type
/// </summary>
/// <param name="AddressType">the type of address to find</param>
/// <param name="state">The state to set. Can be null</param>
/// <returns>city string</returns>
public string AddressState(string AddressType, string State)
{
    string returnValue = string.Empty;
    IUccPresenceContactCardAddress addr = null;
    switch (AddressType.ToLower())
    {
        case "home":
            addr = this.GetAddressObject(UCC_CONTACT_CARD_ADDRESS_TYPE.UCCCCAT_HOME);
            break;
        case "other":
            addr = this.GetAddressObject(UCC_CONTACT_CARD_ADDRESS_TYPE.UCCCCAT_OTHER);
            break;
        case "unknown":
            addr = this.GetAddressObject(UCC_CONTACT_CARD_ADDRESS_TYPE.UCCCCAT_UNKNOWN);
            break;
        case "work":
            addr = this.GetAddressObject(UCC_CONTACT_CARD_ADDRESS_TYPE.UCCCCAT_WORK);
            break;
    }
    if (State != null)
    {
        addr.State = State;
    }
    returnValue = addr.State;
    return returnValue;
}

/// <summary>
/// Iterate on an address collection to find an address object matching the 
/// passed address type
/// </summary>
/// <param name="addressType">UCC_CONTACT_CARD_ADDRESS_TYPE type to find</param>
/// <returns>mathing UccPresenceContactCardAddress</returns>
public UccPresenceContactCardAddress GetAddressObject(UCC_CONTACT_CARD_ADDRESS_TYPE addressType)
{
    UccPresenceContactCardAddress returnValue = null;
    foreach (UccPresenceContactCardAddress address in this._ContactCard.Addresses)
    {
        if (address.Type == addressType)
        {
            returnValue = address;
            break;
        }
    }
    return returnValue;
}

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2000 with Service Pack 4, Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

See Also

Reference

IUccPresenceContactCardAddress Interface
IUccPresenceContactCardAddress Members
Microsoft.Office.Interop.UccApi Namespace