Show All

# role Element

Defines role.

## Type

`xsd:complexType`

## Child Elements

None.

## Attributes

Attribute | Type | Required | Description | Possible Values
--- | --- | --- | --- | ---
name | `xdRoleName` | Yes | Used to identify the role. | Same restriction as xdViewName.

## Definition

    <xsd:element name="role">
      <xsd:complexType>
        <xsd:attribute name="name" type="xsf:xdRoleName" use="required"></xsd:attribute>
      </xsd:complexType>
    </xsd:element>

## Remarks

Each time a role is created for a form, a corresponding role element is created in the form definition file (.xsf). You can assign users to roles by using user names, groups, and XPath user names. Users can be selected for roles in one of four ways:

- Initiator— role for new documents.
- User name— NT domain users (intranet or trusted only).
- XPath user name— user names stored in XML data (intranet or trusted only).
- Group— Active Directory directory service groups (intranet or trusted only).

InfoPath makes the user assignment by following the membership order in the form definition file.

Note This item is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Editions Service Pack 1 or later is not installed. Any form defined by a form definition file (.xsf) that includes this item cannot be opened in InfoPath when service pack features are disabled or unavailable.

## Example

The following is an example of the role element:

    <roles initiator=”xsd:string” default=”xsd:string” hideStatusBarDisplay="xsf:xdYesNo">
          <role name=”xsf:xdRoleName”/>
          <membership>
                <getUserNameFromData dataObject=”xsd:string” select=”xsd:string” memberOf=”xsd:string” />
                <userName name=”xsd:string” memberOf=”xsd:string” />
                <userName name=”xsd:string” memberOf=”xsd:string” />
                <group name=”xsd:string” memberOf=”xsd:string” />
          </membership>
    </roles>

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp