Deleting Scopes from Group




Go back to index

How to delete scopes from scope group


Following code block explains how to programmatically delete scopes from scope group in a site collection.

      using System;
      using SPTool.Library;
      using System.Collections;
      
      namespace SPTool.Test
      {
          class Program
          {
              static void Main(string[] args)
              {
                  SPTSite site = new SPTSite("http://sptool/");

                  // Delete Scopes from Scope Group
                  SPTReturn returnObj = site.DeleteScopesFromScopeGroup("SPTool Group", new ArrayList(new string[] { "SPTool Scope" }));

                  // Delete all scopes in Scope Group
                  //SPTReturn returnObj = site.DeleteAllScopesInScopeGroup("SPTool Group");
            
                  // Check the status of deleting scopes from scope group
                  if (returnObj.State == SPTState.Success)
                  {
                      // Deleting scopes from scope group successful
                  }
                  else
                  {
                      // Deleting scopes from scope group failed
                  }
              }
          }
      }
      


Go back to index