none
Add multiple address content source to the same content source RRS feed

  • Question

  • Hi,

    I've tried with the following to create a new content source and then add multiple SharePoint site addresses to the content source but no luck.

    $searchapp = Get-SPEnterpriseSearchServiceApplication "FAST Search Content Service"
    New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type SharePoint -name "SPContentSource" -StartAddresses "https://abc.mydomain.com","https://xyz.mydomain.com","http://bcd.mydomain.com"

    I got the error: New-SPEnterpriseSearchCrawlContentSource : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'StartAddresses'. Specified method is not supported.

    Many thanks for your help.

    Regards,
    -T.s


    Thuan Soldier
    A 23-year-old man loving Microsoft technologies and making crazy ideas on business journey.
    SharePoint Vietnam | Blog | Twitter

    Saturday, May 4, 2013 8:16 AM

Answers

  • Hi Thuan,

    You're providing an array of strings rather than a single string. It's not clear to me how to provide all the addresses in one go when creating the content source, but what works for me is to first create the content source with a single address and then add additional addresses:

    $searchapp = Get-SPEnterpriseSearchServiceApplication "FAST Search Content Service"
    $cs = New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type SharePoint -name "SPContentSource" -StartAddresses "https://abc.mydomain.com"
    $cs.StartAddresses.Add("http://url1")
    $cs.StartAddresses.Add("http://url2")
    $cs.StartAddresses.Add("http://url3")
    $cs.StartAddresses.Add("http://etc")


    Jason Warren
    Infrastructure Architect


    Monday, May 6, 2013 12:03 AM

All replies

  • Hi Thuan,

    You're providing an array of strings rather than a single string. It's not clear to me how to provide all the addresses in one go when creating the content source, but what works for me is to first create the content source with a single address and then add additional addresses:

    $searchapp = Get-SPEnterpriseSearchServiceApplication "FAST Search Content Service"
    $cs = New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type SharePoint -name "SPContentSource" -StartAddresses "https://abc.mydomain.com"
    $cs.StartAddresses.Add("http://url1")
    $cs.StartAddresses.Add("http://url2")
    $cs.StartAddresses.Add("http://url3")
    $cs.StartAddresses.Add("http://etc")


    Jason Warren
    Infrastructure Architect


    Monday, May 6, 2013 12:03 AM
  • Thank man. It worked well.

    Thuan Soldier
    A 23-year-old man loving Microsoft technologies and making crazy ideas on business journey.
    SharePoint Vietnam | Blog | Twitter

    Monday, May 6, 2013 8:52 AM
  • Looking closer at the documentation, it looks like you could use the following string syntax to pass more than one content source to New-SPEnterpriseSearchCrawlContentSource:

    $searchapp = Get-SPEnterpriseSearchServiceApplication "FAST Search Content Service"
    $startaddresses = "http://url1,http://url2,http://url3,http://etc"
    New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type SharePoint -name "SPContentSource" -StartAddresses $startaddresses

    The documentation (and parameter name of StartAddresses) implies you can provide multiple start addresses, but then gets confusing when it say it expects a URL:

    StartAddresses

    Optional

    System.String

    Specifies the comma-separated list of URLs at which to start a crawl for this content source.

    The type must be a valid URL, in the form http://server_name.

    EDIT: I just confirmed that this approach works. When you provide a single string with a list of comma-seperated URLs to New-SPEnterpriseSearchCrawlContentSource, it creates the content source with the multiple URLs


    Jason Warren
    Infrastructure Architect



    Monday, May 6, 2013 2:05 PM