다음을 통해 공유


AddRoot Method

Topic Last Modified: 2007-03-19

The AddRoot method adds the public or mailbox folder hierarchy at the specified Uniform Resource Identifier (URI) as a root node to the TreeView control. The AddRoot method applies to the ExchangeTreeViewControl Class.

Syntax

Function AddRoot
(
      ByVal uri As String,
      ByVal rootNodeName As String,
      ByVal username As String,
      ByVal password As String,
      ByVal domain As String
) As Boolean
bool AddRoot
(
      string uri,
      string rootNodeName,
      string username,
      string password,
      string domain
);

Parameters

uri

The URI of a public or mailbox folder on a computer running Microsoft® Exchange Server 2007.

rootNodeName

The display name for the root in the TreeView control.

username

The user name for an account that has permissions to view the folder.

password

The password for an account that has permissions to view the folder.

domain

The domain of an account that has permissions to view the folder.

Property Value/Return Value

Returns True if the root was added to the TreeView control successfully.

Returns False if the root was not added to the TreeView control successfully.

Remarks

The AddRoot method will return any appropriate error information in a ControlError Event if the ErrorsReturnedNotDisplayed Property is set to True, or in a message box if it is set to False.

Example

In the following Visual Basic .NET example, a folder hierarchy is added as a root to the TreeView control.

exchangeTreeViewControl1.AddRoot("https://server/public/",
                                 "Public Folders",
                                 "username",
                                 "password",
                                 "domain")

In the following C# example, a folder hierarchy is added as a root to the TreeView control.

exchangeTreeViewControl1.AddRoot("https://server/public/",
                                 "Public Folders",
                                 "username",
                                 "password",
                                 "domain");