UserExtendedProperties.GetValue Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Retrieves an object representing the specified user property. The two available properties are ANID and ANID2.

Namespace:  Microsoft.Phone.Info
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)

Syntax

Public Shared Function GetValue ( _
    propertyName As String _
) As Object
public static Object GetValue(
    string propertyName
)

Parameters

  • propertyName
    Type: System..::.String
    The name of the user property to be retrieved. Property names are case-sensitive.

Return Value

Type: System..::.Object
Returns Object.

Exceptions

Exception Condition
ArgumentNullException

The specified property name is null.

ArgumentOutOfRangeException

The specified property does not exist.

UnauthorizedAccessException

The capability to retrieve the property has not been granted.

NotSupportedException

The specified property cannot be retrieved.

Remarks

The UserExtendedProperties API exposes two properties: ANID and ANID2.

  • ANID can only be accessed from Windows Phone OS 7.0 and Windows Phone OS 7.1 apps that use the Microsoft Advertising SDK for Windows Phone.

  • ANID2 can only be accessed from Windows Phone 8 apps.

The string returned by the ANID and ANID2 properties contains the anonymous identifier and is 32 characters long.

GetValue(String) will either return a non-null object containing the requested value or it will throw one of the exceptions listed in this topic. TryGetValue(String, Object%) provides the same functionality as GetValue(String), but uses a different syntax you may prefer.

Capabilities

If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.

ID_CAP_IDENTITY_USER

Windows Phone 8, Windows Phone OS 7.1

For more info, see App capabilities and hardware requirements for Windows Phone 8.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

UserExtendedProperties Class

Microsoft.Phone.Info Namespace