Sub Change AddressEntry Click On Error Resume Next

Set MyNameSpace = Application.GetNameSpace("MAPI")

Set MyAddressList = MyNameSpace.Addressl_ists("Personal Address Book")

If MyAddressList Is Nothing Then

MsgBox "Personal Address Book Unavailable!", vbExclamation Exit Sub End If

Set MyEntries = MyAddressList.AddressEntries Set MyEntry = MyEntries.Item(1) My Entry. Name = Ucase(MyEntry.Name) MyEntry. Update End Sub

Deleting an Address Entry

The Delete method of the AddressEntry object removes an item from the address book. The following example steps through the items in the Personal Address Book and deletes the first item where the type is set to Sample:

Sub DeleteAddressEntry_Click On Error Resume Next

Set MyNameSpace = Application.GetNameSpace("MAPI")

Set MyAddressList = MyNameSpace.AddressLists("Personal Address Book")

If MyAddressList Is Nothing Then

MsgBox "Personal Address Book Unavailable!", vbExclamation Exit Sub End If

Set MyEntries = MyAddressList.AddressEntries

MsgBox "Adding a sample entry...", vblnformation

Set MyEntry = MyEntries.Add ("SAMPLE","Sample Entry","sampleentry")

MyEntry. Update

MyEntry. Details

Set MyEntry = MyEntries.GetFirst Do While TypeName(MyEntry) <> "Nothing" If MyEntry.Type = "SAMPLE" Then MsgBox "Deleting "& MyEntry, vbCritical MyEntry. Delete Exit Sub End If

Set MyEntry = MyEntries.GetNext Loop

MsgBox "No sample entries found.", vblnformation End Sub

Getting Free/Busy Information for a User

You can determine whether someone is available at a given time using the GetFreeBusy method of the AddressEntry object.

This method returns a string representing 30 days of free/busy information starting at midnight on a specified date. Each character in the string is a digit that indicates whether the person is available during a specified time period. You can specify that the string should indicate only whether the person is available, or you can specify that you want the string to indicate whether a busy time is marked as tentative or out of office.

For example, the following code example returns a string 1440 characters long (48 half-hour periods over 30 days) containing 0 for each half-hour period the person is free, 1 for each period the person has a busy time marked tentative, 3 for each period the person has a busy time marked out of office, and 2 for other busy periods:

0 -1

Post a comment