Export (0) Print
Expand All

SqlSyncScopeDeprovisioning.DeprovisionScope Method

Deprovisions the specified scope by removing all associated synchronization elements from the database.

Namespace:  Microsoft.Synchronization.Data.SqlServer
Assembly:  Microsoft.Synchronization.Data.SqlServer (in Microsoft.Synchronization.Data.SqlServer.dll)

public void DeprovisionScope(
	string scopeName
)

Parameters

scopeName
Type: System.String
The name of the scope to deprovision.

Synchronization components are not removed from a database until all scopes that depend on them are deprovisioned. For example, when two scopes that contain the same table are present in a database, deprovisioning one of the scopes does not remove the metadata table for the table contained in the other scope. When the second scope is deprovisioned, the metadata table is removed.

The following example removes the RetailCustomers scope from a SQL Server database. As an additional example, the script that is used to remove the scope is also saved to a file. This script can be run against other databases to remove the RetailCustomers scope. This step is optional and is not required to deprovision a scope.

// Remove the retail customer scope from the Sql Server client database.
SqlSyncScopeDeprovisioning clientSqlDepro = new SqlSyncScopeDeprovisioning(clientSqlConn);

// First save the deprovisioning script so it can be run on other SQL Server client databases.
// This step is optional.
File.WriteAllText("SampleDeprovisionScript.txt",
    clientSqlDepro.ScriptDeprovisionScope("RetailCustomers"));

// Remove the scope.
clientSqlDepro.DeprovisionScope("RetailCustomers");


' Remove the retail customer scope from the Sql Server client database.
Dim clientSqlDepro As New SqlSyncScopeDeprovisioning(clientSqlConn)

' Save the deprovisioning script so it can be run on other SQL Server client databases.
' This step is optional.
File.WriteAllText("SampleDeprovisionScript.txt", clientSqlDepro.ScriptDeprovisionScope("RetailCustomers"))

' Remove the scope.
clientSqlDepro.DeprovisionScope("RetailCustomers")


Show:
© 2014 Microsoft