CUSTOM_FIELD_DEFINITION Structure

Contains schema information that defines a custom field of an item in the metadata store.

typedef struct _CUSTOM_FIELD_DEFINITION
{
  WCHAR wszFieldName[129];
  SYNC_METADATA_FIELD_TYPE ulFieldType;
  ULONG ulFieldSize;
} CUSTOM_FIELD_DEFINITION;

Members

  • wszFieldName
    The name of the field. The maximum length is 128 characters plus the null terminator.
  • ulFieldType
    The data type of the field.
  • ulFieldSize
    The maximum length of the field for variable-length fields, such as a string or a byte array. This value is ignored for fixed-length types.

Remarks

A set of custom fields can be defined for item metadata. Each field consists of a unique string name and a value. These fields can be used to store any additional metadata about an item that is not otherwise supported by the default set of item metadata. The fields can be accessed through various methods on IItemMetadata, such as IItemMetadata::TryGetFieldByteArray or IItemMetadata::SetFieldByteArray. These fields and their format, including size and data type, are defined when the metadata store is initialized for a replica by using ISyncMetadataStore::InitializeReplicaMetadata.

The schema contains the length for the field value. For fixed-length fields, this value is the size of the data type in bytes. For variable-length fields, this value specifies the maximum length of the field, in bytes for an array of bytes or in characters for a string.

Special Considerations When Using the Implementation Provided by Metadata Storage Service

Field names must obey the following restrictions.

  • Field names must be unique within the field definition set

  • The first character of the name must be either a letter (as defined by the Unicode standard, for example, A-Z or a-z) or an underscore (_).

  • Subsequent characters in the name may either be letters, decimal numbers, or one of these symbols: _@#$.

  • Names may not contain embedded spaces, tabs or any other special characters.

  • Names may not be the same as any Transact-SQL reserved words.

The metadata store also imposes certain size limits that affect field values. The total size for each item metadata entry is limited to 8060 bytes. The metadata store file is limited to 4GB.

Requirements

Header: Metastore.h

See Also

Concepts

Sync Framework Metadata Storage Service Components