Microsoft Office Web Discussions Client Objects

Global
DiscussionServers (DiscussionServer)
Discussions (Discussion)

Legend

Object and collection
Object only


Overview of Discussion Servers and Discussions

In Microsoft Office, the Microsoft Office Web Discussions Client library enables you to control objects in Discussions and DiscussionServers collections programmatically. You can add new discussions and discussion servers, or you can read, modify, or delete existing discussions and discussion servers.

Important: To enable this library in your programming environment, you must first set a reference to the Microsoft Office Web Discussions Client Type Library (OWSCLT.DLL).

The Global object is your starting point for exploring discussions and discussion servers. The Global object represents an instance of a discussion server. The Global object enables you to add subscriptions to discussion servers, get the name of the current Microsoft Office user, and return the collection of discussion servers or discussions on a specific discussion server.

The DiscussionServers collection object contains one or more DiscussionServer objects. Each DiscussionServer object represents a discussion server registered on the computer you’re currently using. A DiscussionServer object is composed of a friendly name and a Uniform Resource Locator (URL) that provide connection information about the discussion server to users.

You can open the Discussions collection for a particular URL by using the OpenDiscussions method of the Global object to return the Discussions collection for the document specified by the URL. This Discussions collection can contain many levels of discussions; these levels are organized in a hierarchy. Each Discussion object in top-level Discussions collection is a comment about the topic document. Each Discussion object can contain child Discussion objects, which are replies to the original Discussion object. Replies to replies are at the next level in the discussion hierarchy, and so on. You can traverse the discussions hierarchy by using the Discussions property of the Discussion object.


Returning an Object from a Collection

The Item property returns a single object from a collection. The following example sets the dscSupplies variable to a Discussion object that represents the first discussion in the Discussions collection.

Dim dscDiscussions As Discussions
Set dscDiscussions = _
    OpenDiscussions("http://samples.microsoft.com")
Dim dscSupplies As Discussion
Set dscSupplies = dscDiscussions.Item(1)

Because the Item property is the default property for most collections, you can write the same statement more concisely by omitting the Item keyword.

Set dscSupplies = dscDiscussions(1)

For more information about a specific collection, see the Help topic for the collection or the Help topic for the collection’s Item property.


Discussion Object

Global
DiscussionServers (DiscussionServer)
Discussions (Discussion)

Represents a discussion in the Microsoft Office host application. The Discussion object is a member of the Discussions collection.

Using the Discussion Object

Use Discussions(Index), where Index is the index number of a discussion, to return a single Discussion object. The following example sets the variable dscOfficeSupplies to the first discussion in the Discussions collection.

Set dscOfficeSupplies = dscDiscussions(1)

Use the AutoCommit property to set or return the status of commit operations, which govern whether changes to properties of a Discussion object immediately affect the discussion store. Use the Commit method to force the application to save all properties of the current discussion item (including property changes) to the discussion store on the server. The following example checks the value of AutoCommit for the specified discussion and, if the property is set to False, the example uses the Commit method to save changes to the discussion store.

If dscDiscussions(1).Discussions(4).AutoCommit = False Then
    dscDiscussions(1).Discussions(4).Commit
End If

Use the Author property to get the user name of the current discussion’s author. Use the LoginName property to get the Microsoft Windows NT logon name of the discussion’s author. Use the Timestamp property to get the date and time that the discussion was created or the date and time of the most recent modification to the discussion. The following example displays the author's name, the date and time of creation or the most recent modification, and the Microsoft Windows NT logon name for the specified discussion .

MsgBox dscDiscussions(1).Discussions(5).Author & _
    " created this discussion at " & _
    dscDiscussions(1).Discussions(5).Timestamp & _
    " while logged in as Windows NT user " & _
    dscDiscussions(1).Discussions(5).LoginName

Use the Discussions property to return the collection of all discussion items that are replies to the current discussion. The returned collection can also contain a Discussions collection composed of replies to a parent discussion, which you can access by using the Discussions property for a specific discussion within that collection.

Use the Subject, Text, and Bookmark properties to return or set those elements of the specified discussion.


Discussions Collection

Global
DiscussionServers (DiscussionServer)
Discussions (Discussion)

A collection of Discussion objects that represent discussions registered in the Microsoft Office host application.

Using the Discussions Collection

Use the OpenDiscussions method of the Global object to return the Discussions collection for the document accessed by the specified Uniform Resource Locator (URL). The following example returns the Discussions collection for the folder "http://examples.microsoft.com."

Set dscDiscussions = _
    OpenDiscussions("http://examples.microsoft.com")

Use the Add method to add a new Discussion object to the Discussions collection. The following example adds a new discussion response to the first Discussion object in the collection.

Set myResponse = dscDiscussions(1).Discussions.Add _
    Subject:="Supply information", Text:="Staples are here!", Bookmark:="Staples"

Use the URL property to return the URL for the document that contains the specified Discussions collection, As shown in the following example.

Dim dscDiscussions As Discussions
Set dscDiscussions = OpenDiscussions("http://samples.microsoft.com")
MsgBox dscDiscussions.URL

Use Discussions(Index), where Index is the index number of a discussion, to return a single Discussion object. The following example sets the variable dscOfficeSupplies to the first discussion in the Discussions collection.

Set dscOfficeSupplies = dscDiscussions(1)


DiscussionServer Object

Global
DiscussionServers (DiscussionServer)
Discussions (Discussion)

Represents a discussion server in the Microsoft Office host application. The DiscussionServer object is a member of the DiscussionServers collection.

Using the DiscussionServer Object

Use DiscussionServers(Index), where Index is the index number of the specified discussion server, to return a single DiscussionServer object. The following example sets the variable dscAccounting to the third server in the DiscussionServers collection.

Set dscAccounting = dscServers(3)

Use the FriendlyName property to set or return the friendly name of the specified discussion server. The following example changes the friendly name of the first server in the collection to "Shipping Department Server".

dscServers(1).FriendlyName = _
    "Shipping Department Server"

Use the ServerAddress property to set or return the Uniform Resource Locator (URL) for the specified discussion server. The following example changes the URL of the first server in the collection to "http://example.microsoft.com".

dscServers(1).ServerAddress = _
    "http://example.microsoft.com/"

Use the SetAsDefault method to set the specified discussion server as the default server for the discussions user interface and for all subsequent calls to the global method OpenDiscussions. The following example sets the third server in the DiscussionServers collection as the default discussion server.

dscServers(3).SetAsDefault


DiscussionServers Collection

Global
DiscussionServers (DiscussionServer)
Discussions (Discussion)

A collection of DiscussionServer objects that represent discussion servers in the Microsoft Office host application.

Using the DiscussionServers Collection

Use the OpenDiscussions method of the Global object to return the DiscussionServers collection for all discussion servers registered on the computer being used. The following example returns the DiscussionServers collection and displays a message box showing the number of servers in the collection.

Dim dscDiscussionServersCollection As DiscussionServers
Set dscDiscussionServersCollection = DiscussionServers
MsgBox dscDiscussionServersCollection.Count

Use the Add method to add a new discussion server to the collection. The following example adds a new discussion server with the friendly name "Sample Server" and the Uniform Resource Locator (URL) http://samples.microsoft.com.

Dim dscServers As DiscussionServers
Set dscServers = DiscussionServers
dscServers.Add FriendlyName:="Sample Server", _
    ServerAddress:="http://samples.microsoft.com/"

Use DiscussionServers(Index), where Index is the index number of the specified discussion server, to return a single DiscussionServer object. The following example sets the variable dscAccounting to the third server in the DiscussionServers collection.

Set dscAccounting = dscServers(3)


Global Object

Global
DiscussionServers (DiscussionServer)
Discussions (Discussion)

Represents an instance of the Microsoft Office Server Extensions (OSE) library. Using the Global object, you can add subscriptions to discussion servers, get the name of the current Microsoft Office user, and return the collection of discussion servers or discussions on the OSE host.

Using the Global Object

Use the CurrentUserName property to return the name of the current Microsoft Office user. The following example displays a message box containing the name of the current user.

MsgBox "The current Microsoft Office user is " & _
    CurrentUserName

Use the OpenDiscussions method to return the Discussions collection for the document specified by the Uniform Resource Locator (URL). The following example returns the Discussions collection for the folder http://examples.microsoft.com.

Set dscDiscussions = _
    OpenDiscussions("http://examples.microsoft.com")


Add Method

Add method as it applies to the Discussions object.

Adds a new Discussion object to the specifie Discussions collection.

expression.Add(Subject, Text, Bookmark)

expression Required. An expression that returns one of the above objects.

Subject Optional String. The subject of the specified discussion.

Text Optional String. The body text of the specified discussion.

Bookmark Optional String. The unique identifier for the position of the specified discussion within the document.

Remarks

The Author property for the new discussion is automatically set to the current user name determined by the Microsoft Office host application.

Add method as it applies to the DiscussionServers object.

Adds a new DiscussionServer object to the DiscussionServers collection.

expression.Add(FriendlyName, ServerAddress)

expression Required. An expression that returns one of the above objects.

FriendlyName Required String. The friendly name of the specified discussion server.

ServerAddress Required String. The Uniform Resource Locator (URL) of the specified discussion server.

Remarks

The URL specified in the ServerAddress argument must contain a trailing slash character, as in the following example, which uses the URL http://samples.microsoft.com.

dscServers.Add "Samples Folder", _
    http://samples.microsoft.com/

Example

As it applies to the Discussions object.

This example adds a new discussion response to the specified Discussion object.

Set strResponse = dscDiscussions(1).Discussions.Add _
    ("Supply information", "Staples are here!", "Staples")

As it applies to the DiscussionServers object.

This example adds a new discussion server with the friendly name "Corporate Information Server" and the URL http://samples.microsoft.com.

Dim dscServers As DiscussionServers
Set dscServers = DiscussionServers
dscServers.Add "Corporate Information Server", _
    "http://samples.microsoft.com/"


Commit Method

Commits all properties of the specified Discussion object (including property changes) to the discussion store on the server.

expression.Commit

expression An expression that returns a Discussion object.

Example

This example commits all properties (including all property changes) that affect the specified discussion.

Dim dscDiscussions As Discussions
Set dscDiscussions = OpenDiscussions(URL:="http://samples.microsoft.com")
dscDiscussions(1).Discussions(1).Commit


Delete Method

Deletes the specified object from the object it's contained in.

expression.Delete

expression An expression that returns a Discussion or DiscussionServer object.

Remarks

When you use the Delete method to remove a discussion item from a DiscussionServer object, any replies to the discussion item are automatically promoted to the level of the deleted item.

Example

This example deletes the third discussion item from the Discussions collection. Any discussions that are descendants of the affected discussion are promoted to the level of the deleted item.

dscCurrentCollection(3).Delete


OpenDiscussions Method

Returns the Discussions collection for the document specified by the Uniform Resource Locator (URL). Read-only Object.

expression.OpenDiscussions(URL)

expression An expression that returns a Microsoft Office Server Extensions (OSE) object.

URL Required. A String that represents the URL of the discussion server.

Example

This example returns the Discussions collection for the folder http://examples.microsoft.com.

Dim dscDiscussions As Discussions
Set dscDiscussions = _
    OpenDiscussions("http://examples.microsoft.com")


SetAsDefault Method

Sets the specified discussion server as the default server for the discussions user interface and for all subsequent calls to the global method OpenDiscussions.

expression.SetAsDefault

expression An expression that returns a DiscussionServer object.

Remarks

The default discussion server is always the first DiscussionServer object in the DiscussionServers collection. Using the SetAsDefault method reorders the members of the DiscussionServers collection so that the default server is in the position referred to by Item(1). Therefore, after calling this method, you should discard any variables that have been set to old DiscussionServer objects.

Example

This example sets the third server in the DiscussionServers collection as the default discussion server.

dscServers(3).SetAsDefault


Author Property

Gets the user name of the current discussion item’s author. Read-only String.

expression.Author

expression Required. An expression that returns a Discussion object.

Example

This example sets the boolean value positiveMatch to True if the Author property returns the name “Jim Hance”.

Dim dscDiscussions As Discussions
Dim positiveMatch As Boolean
Set dscDiscussions = OpenDiscussions("http://samples.microsoft.com")
If dscDiscussions(1).Discussions(2).Author = "Jim Hance" Then
    positiveMatch = True
End If


AutoCommit Property

Returns or sets a value that specifies whether changes to properties of the specified Discussion object immediately affect the discussion store. Read/write Boolean.

expression.AutoCommit

expression Required. An expression that returns a Discussion object.

Remarks

If this property is set to True, all programmatic changes to individual properties of a Discussion object are immediately committed to the discussion store. If it’s set to False, no property changes are committed to the discussion store until you call the Commit method. If you don’t call the Commit method before ending the session, all pending property changes are lost. The default value is True.

For performance reasons, you may want to set the AutoCommit property to False and use the Commit method as appropriate.

Example

This example sets the AutoCommit property to False for the specified Discussion object.

Dim dscDiscussions As Discussions
Set dscDiscussions = OpenDiscussions("http://samples.microsoft.com")
dscDiscussions(1).Discussions(1).AutoCommit = False


Bookmark Property

Returns or sets a String representing the unique identifier for the position of the specified Discussion object in the document.

expression.Bookmark

expression Required. An expression that returns a Discussion object.

Example

This example sets the specified discussion's bookmark to "Supplies".

Dim dscDiscussions As Discussions
Set dscDiscussions = OpenDiscussions("http://samples.microsoft.com")
dscDiscussions(1).Discussions(3).Bookmark = _
    "Supplies"


Count Property

Returns the number of items in the specified collection. Read-only Long.

Remarks

Discussions(1).Count returns the number, or count, of items in the first discussion in the Discussions collection. The Count property doesn’t count recursively, however, and any discussions that are replies to the Discussion(1) object aren’t included in the count.

Example

This example displays a message box containing the number, or count, of all discussions in the Discussions collection.

Dim dscDiscussions As Discussions
Set dscDiscussions = _
    OpenDiscussions("http://examples.microsoft.com")
dscDiscussions.Add "Supply room questions", _
    "Did anyone order staples?",
MsgBox dscDiscussions.Count


CurrentUserName Property

Returns or sets the name of the current Microsoft Office user. Read\write String.

expression.CurrentUserName

expression Required. An expression that returns a Global object.

Example

This example displays a message box containing the name of the current Microsoft Office user.

MsgBox "The current Microsoft Office user is " & _
    CurrentUserName


Discussions Property

Returns the collection of all Discussion objects that are replies to the specified Discussion object.

expression.Discussions

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The returned collection can also contain a Discussion collection composed of replies to a parent discussion, which you can access by using the Discussions property for a specific Discussion object within that collection. There’s no functional limit to the number of levels of discussions, other than the limits of the mass storage device that houses the server you’re using.

Example

This example uses the Discussions property to return a discussion that’s a response to the specified discussion, and then it sets the returned discussion's subject to "More Supply Questions".

Dim dscDiscussions As Discussions
Set dscDiscussions = OpenDiscussions("http://samples.microsoft.com")
dscDiscussions(1).Discussions(3).Subject = _
    "More Supply Questions


FriendlyName Property

Sets or returns the friendly name of the specified discussion server. Read/write String.

Example

This example changes the friendly name of the specified discussion server to "Accounting Department Information Server".

dscServers(1).FriendlyName = _
    "Accounting Department Information Server"


Index Property

The index number of the specified Discussion object within the Discussions collection. Read-only Long.

expression.Index

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example uses the Index property to find the position of the specified Discussion object in the Discussions collection.

Set myResponse = dscDiscussions(1).Discussions.Add _
    ("Supply information", "Staples are here!", "Staples")
MsgBox myResponse.Index


Item Property

Returns a Discussion object from a Discussions collection, or returns a DiscussionServer object from a DiscussionServers collection.

expression.Item(Index)

expression Required. An expression that returns a Discussion or DiscussionServer object.

Index Required Variant. The index number of the discussion or discussion server to be returned.

Example

This example uses the Item property to display a message box containing the name of the author of second response to the fifth discussion on the current file or folder.

MsgBox dscDiscussions.Item(5).Discussions.Item(2).Author


LoginName Property

Returns a String representing the Microsoft Windows NT alias of the author of the specified Discussion object.

expression.LoginName

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The logon name is usually the same as the user's e-mail alias.

Example

This example displays a message box containing the logon name of the current Microsoft Windows NT user.

MsgBox dscDiscussions(1).LoginName


Parent Property

Returns the parent Object for the specified object.

expression.Parent

expression Required. An expression that returns one of the objects in the Applies To list.


ServerAddress Property

Sets or returns the Uniform Resource Locator (URL) for the specified discussion server. Read/write String.

Example

This example changes the URL of the specified discussion server to http://example.microsoft.com.

dscServers(1).ServerAddress = _
    "http://example.microsoft.com/"


Subject Property

Returns or sets a String representing the subject of the specified Discussion object.

expression.Subject

expression Required. An expression that returns a Discussions object.

Example

This example sets the specified discussion's subject to "More Supply Questions".

Dim dscDiscussions As Discussions
Set dscDiscussions = OpenDiscussions("http://samples.microsoft.com")
dscDiscussions(1).Discussions(3).Subject = _
    "More Supply Questions"


Text Property

Returns or sets a String representing the body text of the specified Discussion object.

expression.Text

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

A discussion can contain up to 64 kilobytes of text.

Example

This example sets the specified discussion's text to "Who do I see to get more staples?".

Dim dscDiscussions As DiscussionsSet dscDiscussions = _
                OpenDiscussions("http://samples.microsoft.com")

dscDiscussions(1).Discussions(3).Text = _
    "Who do I see to get more staples?"


Timestamp Property

Returns a Date representing the date and time that the specified Discussion object was created or the date and time of the most recent modification to the Discussion object.

expression.Timestamp

expression Required. An expression that returns a Discussion object.

Example

This example displays the date and time of the creation of or most recent change to the specified discussion.

MsgBox dscDiscussions(1).Timestamp


URL Property

Returns the Uniform Resource Locator (URL) for the document containing the specified Discussions collection. Read-only String.

Example

This example displays the URL for the specified Discussions collection.

Dim dscDiscussions As Discussions
Set dscDiscussions = OpenDiscussions("http://samples.microsoft.com")
MsgBox dscDiscussions.URL


Hidden Language Element

You have requested Help for a language element that is hidden, and therefore unavailable for programmatic access.


Unsupported Language Element

You have requested Help for a language element that is not supported.


INDEX~TEXT
seealso~"See&nbsp;Also"
appliesto~"Applies&nbsp;To"
elements~"Elements"
properties~"Properties"
methods~"Methods"
events~"Events"
example~"Example"
specifics~"Specifics"
show~"Show&nbsp;description"
hide~"Hide&nbsp;description"


DiscussionServers Collection

 Discussions Collection


Discussion Object


Discussion Object

 DiscussionServer Object


Global Object


DiscussionServer Object


Author Property

 AutoCommit Property

 Bookmark Property

 Discussions Property

 Index Property

 LoginName Property

 Parent Property

 Subject Property

 Text Property

 Timestamp Property
Discussions Collection


Add Method
Count Property

 Item Property

 Parent Property

 URL Property
Discussion Object


Delete Method

 SetAsDefault Method
FriendlyName Property

 ServerAddress Property


Add Method


OpenDiscussions Method
CurrentUserName Property


Discussion Object

 DiscussionServers Collection

 Discussions Collection


Discussions Collection