Creating Content Source




Go back to index

How to create content source


Following code block explains how to programmatically create a content source in SSP.

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

                  ArrayList urls = new ArrayList();
                  urls.AddRange(new string[]{ "http://sptool/", "http://sptool:5000/"});
                  
                  // Create Sharepoint Content Source
                  SPTReturn returnObj = ssp.CreateContentSource(SPTContentSourceType.SharePointContentSource,"SPTool SPCS", urls, true);
                             
                  // Check the status of content source creation
                  if (returnObj.State == SPTState.Success)
                  {
                      // Content Source creation successful
                  }
                  else
                  {
                      // Content Source creation failed
                  }
              }
          }
      }
      


Go back to index