Creating Scope in Site




Go back to index

How to create scope in site


Following code block explains how to programmatically create a scope in a site collection.

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

                  // Create Scope
                  SPTReturn returnObj = site.CreateScope("SPTool Site Scope", "SPTool Site Scope Description", true, "", "AlwaysCompile");

                  // Check the status of creating scope
                  if (returnObj.State == SPTState.Success)
                  {
                      // Scope created successfully
                  }
                  else
                  {
                      // Creating Scope failed
                  }
              }
          }
      }
      


Go back to index