RasPhoneBook Class

DotRas SDK

Collapse image Expand Image Copy image CopyHover image
Represents a remote access service (RAS) phone book. This class cannot be inherited.

Namespace: DotRas
Assembly: DotRas (in DotRas.dll) Version: 1.3.5166.33435 (1.3.0.0)

Syntax

C#
public sealed class RasPhoneBook : RasComponent
Visual Basic
Public NotInheritable Class RasPhoneBook
	Inherits RasComponent
Visual C++
public ref class RasPhoneBook sealed : public RasComponent
F#
[<SealedAttribute>]
type RasPhoneBook =  
    class
        inherit RasComponent
    end

Remarks

When using RasPhoneBook to monitor a phone book for external changes, ensure the SynchronizingObject property is set if thread synchronization is required. If this is not done, you may get cross-thread exceptions thrown from the component. This is typically needed with applications that have an interface; for example, Windows Forms or Windows Presentation Foundation (WPF).

There are multiple phone books in use by Windows at any given point in time and this class can only manage one phone book per instance. If you add an entry to the all user's profile phone book, attempting to manipulate it with the current user's profile phone book opened will result in failure. Entries will not be located, and changes made to the phone book will not be recognized by the instance.

When attempting to open a phone book that does not yet exist, the RasPhoneBook class will automatically generate the file to be used. Also, setting the EnableFileWatcher property to true will allow the class to monitor for any external changes made to the file.

Known Limitations

  • For phone books which are not located in the all users profile directory (including those in custom locations) any stored credentials for the entries must be stored per user.
  • The RasPhoneBook component may not be able to modify entries in the All User's profile without elevated application privileges. If your application cannot request elevated privileges you can either use the current user profile phone book, or use a custom phone book in a path that will not require elevated permissions.

Examples

The following example shows how to open a phone book in a custom location using a RasPhoneBook class.
C# Copy imageCopy
using (RasPhoneBook pbk = new RasPhoneBook())
{
    pbk.Open("C:\\Test.pbk");
}
Visual Basic Copy imageCopy
Dim pbk As RasPhoneBook
Try
    pbk = New RasPhoneBook
    pbk.Open("C:\Test.pbk")
Finally
    If (pbk IsNot Nothing) Then
        pbk.Dispose()
    End If
End Try

Inheritance Hierarchy

See Also