RDONickNames object

 

RDONickNames collection  represents the list of nicknames from a particular profile (RDOSession.GetNickNames, both NK2 and store based) or a store (RDOPstStore.GetNickNames and RDOExchangeMailboxStore.GetNickNames).

 

Returned by:

RDOSession.GetNickNames

RDOPstStore.GetNickNames

RDOExchangeMailboxStore.GetNickNames

 

See also: RDONickName

 

The example below enumerates nicknames from the the current profile

'all nicknames from the current profile
set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Nicknames = Session.GetNicknames
for each NickName in NickNames
    Debug.Print NickName.Name & " - " & NickName.SmtpAddress
next

 

The example below adds a new one-off nickname. Besides a string you can also pass an address entry object, recipient object or RDORecipients collection

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Nicknames = Session.GetNicknames
set NickName = Nicknames.Add("Joe The User <test@dimastr.com>")
Nicknames.Save

 

 

The example below enumerates nicknames from all profiles

'all nicknames in all profiles
set Session = CreateObject("Redemption.RDOSession")
for each ProfileName in Session.Profiles
    Debug.Print("-----------------------------")
    Debug.Print("--- " & ProfileName & " --- ")
    Debug.Print("-----------------------------")
    set NickNames = Session.GetNickNames(ProfileName)
    for each NickName in NickNames
        Debug.Print NickName.Name & " - " & NickName.SmtpAddress
    next
next

 

The example below opens an .NK2 file with the nicknames (it does not have to come from a local machine)

'nicknames in a file
set Session = CreateObject("Redemption.RDOSession")
set NickNames = Session.GetNickNames("C:\Documents and Settings\dmitry\Application Data\Microsoft\Outlook\Outlook.NK2")
for each NickName in NickNames
    Debug.Print NickName.Name & " - " & NickName.SmtpAddress
next

 

The example reads nicknames from an Exchange mailbox store .

'nicknames in a file
set Session = CreateObject("Redemption.RDOSession")

Session.LogonExchangeMailbox("user_name", "ServerName")

set Store = Session.GetSharedMailbox("Another_User")
set NickNames = Session.GetNickNames(Store)
for each NickName in NickNames
    Debug.Print NickName.Name & " - " & NickName.SmtpAddress
next

 

 

Properties

Methods

 


Derived from: IDispatch


Properties


Count

Integer, read-only. Number of items in the collection.

 

see example above

FileName

String, read-only. The fully qualified name of the NK2 file that stores the nicknames.

 

 

ProfileName

String, read-only. The profile name for which the nicknames are returned.

If RDOSession.GetNickNames was called with an explicit file name, this property will be empty.

 

 

Methods


Add(NameRecipientAddressEntry)
Adds and returns new nickname (RDONickName) to the collection.

NameRecipientAddressEntry string,
RDORecipient, RDOAddressEntry or
RDORecipients object.

If RDORecipients object is passed as the parameter, RDONickName object corresponding to the recipient in the collection will be returned

'copy nicknames from the default store to a new PST file
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set DefaultStore = Session.Stores.DefaultStore
set PstStore = Session.Stores.AddPSTStore("c:\temp\nicknames.pst")
set DefaultNicknames = DefaultStore.GetNicknames
set PstNicknames = PstStore.GetNicknames
PstNicknames.Clear
for each objNickName in DefaultNicknames
    
PstNicknames.Add objNickName.GetAddressEntry
next
PstNicknames.Save

Clear
Deletes all items in the nicknames collection.
Save must be called to commit the changes.

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Nicknames = Session.GetNicknames
Nicknames .Clear
Nicknames Save

Item(Index)

Returns a nickname (RDONickName object) with the given index.

 

Index - integer. And index of the nick name, 1 through Count

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Nicknames = Session.GetNicknames
for i =1 to NickNames.Count
set Nickname = Nicknames.Item(i)
    Debug.Print NickName.Name & " - " & NickName.SmtpAddress
next

 

Remove(Index) Removes the nickname with the specified index (1 through Count).

 
Save
Commits the changes to the nicknames collection.
Save must be called for all modifications to be saved.