Adding Scope Rule




Go back to index

How to add scope rule for a scope


Following code block explains how to programmatically add scope rule for a scope in SSP.

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

                  // Add web address scope rule
                  SPTReturn returnObj = ssp.AddWebAddressScopeRule("SPTool Scope", "Folder", "http://sptool/blogs/", "Include");

                  // Add content source scope rule
                  //returnObj = ssp.AddContentSourceScopeRule("SPTool Scope", "SPTool SPCS", "Exclude");

                  // Add property query scope rule
                  //returnObj = ssp.AddPropertyQueryScopeRule("SPTool Scope", "Author", @"Domain\UserName" , "Include");

                  // Add all content scope rule
                  //returnObj = ssp.AddAllContentScopeRule("SPTool Scope");

                  // Check the status of scope rule addition
                  if (returnObj.State == SPTState.Success)
                  {
                      // Adding scope rule successful
                  }
                  else
                  {
                      // Adding scope rule failed
                  }
              }
          }
      }


Go back to index