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)
Syntax
'Declaration
Public Sub DeprovisionScope ( _
scopeName As String _
)
'Usage
Dim instance As SqlSyncScopeDeprovisioning
Dim scopeName As String
instance.DeprovisionScope(scopeName)
public void DeprovisionScope(
string scopeName
)
public:
void DeprovisionScope(
String^ scopeName
)
member DeprovisionScope :
scopeName:string -> unit
public function DeprovisionScope(
scopeName : String
)
Parameters
- scopeName
Type: System.String
The name of the scope to deprovision.
Remarks
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.
Examples
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")
See Also
Reference
SqlSyncScopeDeprovisioning Class
Microsoft.Synchronization.Data.SqlServer Namespace
Other Resources
How to: Provision and Deprovision Synchronization Scopes and Templates (SQL Server)