FullName Property

Microsoft Outlook Visual Basic

FullName Property

       

Returns or sets a String specifying the whole, unparsed full name for the contact. Read/write.

expression.FullName

expression    Required. An expression that returns a ContactItem object.

Remarks

This property is parsed into the FirstName, LastName, MiddleName, and Suffix properties, which may be changed or entered independently should they be parsed incorrectly. Note that any such changes or entries to the FirstName, LastName, MiddleName or Suffix properties will be overwritten by any subsequent changes or entries to FullName.

Example

This Visual Basic for Applications example uses the Restrict method to get all Inbox items dealing with Project X and moves them to the Project X folder.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder =  _
    myNameSpace.GetDefaultFolder(olFolderInbox)
Set myItems = myFolder.Items
Set myRestrictItems = myItems.Restrict _     ("[Categories] = 'Project X'")
For Each myItem In myRestrictItems
    myItem.Move myFolder.Folders("Project X")
Next

If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.

Set myNameSpace = Application.GetNameSpace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(6)
Set myItems = myFolder.Items
Set myRestrictItems = myItems.Restrict _     ("[Categories] = 'Project X'")
For Each myItem In myRestrictItems
    myItem.Move myFolder.Folders("Project X")
Next

This Visual Basic for Applications example uses the Restrict method to apply a filter to the Contact items based on the item's LastModificationTime property.

Public Sub ContactDateCheck()
   Set myOlApp = CreateObject("Outlook.Application")
   Set myNameSpace = myOlApp.GetNamespace("MAPI")
   Set myContacts = myNameSpace.GetDefaultFolder(olFolderContacts).Items
   Set myItems = myContacts.Restrict("[LastModificationTime] > '05/15/97'")
   For Each myItem In myItems
       MsgBox myItem.FullName & ": " & MyItem.LastModificationTime
   Next
End Sub

The following Visual Basic for Applications example is the same as the example above, except that it demonstrates the use of a variable in the filter.

Public Sub ContactDateCheck()
   Set myOlApp = CreateObject("Outlook.Application")
   Set myNameSpace = myOlApp.GetNamespace("MAPI")
   Set myContacts = myNameSpace.GetDefaultFolder(olFolderContacts).Items
   DateStart = #6/11/97#
   DateToCheck$ = "[LastModificationTime] >= """ & DateStart & """"
   Set myRestrictItems = myContacts.Restrict(DateToCheck$)
   For Each myItem In myRestrictItems
      MsgBox myItem.FullName & ": " & MyItem.LastModificationTime
   Next
End Sub