Jaa


How to: Delete an Article (RMO Programming)

You can delete articles programmatically by using Replication Management Objects (RMO). The RMO classes you use to delete an article depend on the type of publication to which the article belongs.

To delete an article that belongs to a snapshot or transactional publication

  1. Create a connection to the Publisher by using the ServerConnection class.

  2. Create an instance of the TransArticle class.

  3. Set the Name, PublicationName, and DatabaseName properties.

  4. Set the connection from step 1 for the ConnectionContext property.

  5. Check the IsExistingObject property to verify that the article exists. If the value of this property is false, either the article properties in step 3 were defined incorrectly or the article does not exist.

  6. Call the Remove method.

  7. Close all connections.

To delete an article that belongs to a merge publication

  1. Create a connection to the Publisher by using the ServerConnection class.

  2. Create an instance of the MergeArticle class.

  3. Set the Name, PublicationName, and DatabaseName properties.

  4. Set the connection from step 1 for the ConnectionContext property.

  5. Check the IsExistingObject property to verify that the article exists. If the value of this property is false, either the article properties in step 3 were defined incorrectly or the article does not exist.

  6. Call the Remove method.

  7. Close all connections.

See Also

Tasks

How to: Delete an Article (Replication Transact-SQL Programming)

Help and Information

Getting SQL Server 2005 Assistance