UserInformation class

UserInformation class

Specifies information about the user. To learn more, visit the Working with Fields documentation article.


UserInformation()The default constructor.


addressGets or sets the user’s postal address.
default_userDefault user information.
initialsGets or sets the user’s initials.
nameGets or sets the user’s name.


Shows how to set user details, and display them using fields.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)
# Create a UserInformation object and set it as the data source for fields that display user information.
user_information = aw.fields.UserInformation() = 'John Doe'
user_information.initials = 'J. D.'
user_information.address = '123 Main Street'
doc.field_options.current_user = user_information
# Insert USERNAME, USERINITIALS, and USERADDRESS fields, which display values of
# the respective properties of the UserInformation object that we have created above.
self.assertEqual(, builder.insert_field(field_code=' USERNAME ').result)
self.assertEqual(user_information.initials, builder.insert_field(field_code=' USERINITIALS ').result)
self.assertEqual(user_information.address, builder.insert_field(field_code=' USERADDRESS ').result)
# The field options object also has a static default user that fields from all documents can refer to. = 'Default User'
aw.fields.UserInformation.default_user.initials = 'D. U.'
aw.fields.UserInformation.default_user.address = 'One Microsoft Way'
doc.field_options.current_user = aw.fields.UserInformation.default_user
self.assertEqual('Default User', builder.insert_field(field_code=' USERNAME ').result)
self.assertEqual('D. U.', builder.insert_field(field_code=' USERINITIALS ').result)
self.assertEqual('One Microsoft Way', builder.insert_field(field_code=' USERADDRESS ').result)
doc.update_fields() + 'FieldOptions.CurrentUser.docx')

See Also