ISharedPropertyGroup::CreateProperty Method

Creates and returns a reference to a new SharedProperty with a specified name. If a shared property by that name already exists, CreateProperty returns a reference to the existing property.

Provided By

ISharedPropertyGroup Interface

HRESULT ISharedPropertyGroup::CreateProperty (
    BSTR name,
    VARIANT_BOOL* pfExists;
    ISharedProperty** ppProp,
);

Parameters

name
[in] The name of the property to create. You can use this name later to obtain a reference to this property by using the get_Property method.

pfExists
[out] A reference to a Boolean value that's set to VARIANT_TRUE on return from this method if the shared property specified in the name parameter existed prior to this call, and VARIANT_FALSE if the property was created by this call.

ppProp
[out] A reference to a SharedProperty object with the name specified in the name parameter, or NULL if an error is encountered.

Return Values

S_OK
A reference to a shared property with the name specified in the name parameter is returned in the parameter ppProp.

E_INVALIDARG
One or more of the arguments passed in is invalid.

Remarks

When you create a shared property, its value is set to the default, which is a VARIANT of type VT_I4, with a value of 0.

If you create a shared property with the CreateProperty method, you can access that property only by using the get_Property method. You can't assign a numeric index to the same property and then access it by using the get_PropertyByPosition method.

The same shared property group can contain some shared property objects that are identified by name and others that are identified by position.

Example

See Also

Sharing State, ISharedPropertyGroup::CreatePropertyByPosition Method, ISharedPropertyGroup::get_PropertyByPosition Method, ISharedPropertyGroup::get_Property Method