Hey! Where can I get SPSiteManager 2.2??? It's not in the Utility Suite!

A lot of folks are asking me where they can get SPSiteManager 2.2 since I noted that it was complete.  SPSiteManager (along with an update to SPUserUtil, and a couple of other tweaks) were going to be packaged up as the 2.6 release of The SharePoint Utility Suite and updated at the SharePoint Products and Technologies Web Component Directory.

Well, the decision was made to go ahead and move this package of tools over to CodePlex.  The CodePlex project is already created at https://www.codeplex.com/Wiki/View.aspx?ProjectName=SPUS , but it's going to take me a few days before I can start getting the individual tools released there.  And it will not include all the tools that previously existing there.  Also, I'm only sending it out on an very "As Needed" basis right now to ensure we've got all the features fully tested.

In fact, while working with a couple of customers, I found two problems I need to correct before pushing it back out.  These two problems exist in the 2.1 version that is in the 2.5 SPUS package.  These are not major problems, just strange that no one has reported them yet :).


Problem 1

The first problem is in the MoveSiteToDB() Method as noted here:

MoveSiteToDB()

//====================================================================

// Get the basic information from the source site

// And also setup the restore URL from the target.

//====================================================================

SPSite oldSite = js.GetSite();

string strRestoreURL;

if(js.TargetUrl!=null)

      strRestoreURL = js.TargetUrl;

else

      strRestoreURL = js.SourceUrl;

bool bSwitched=false;

string strSiteUrl = oldSite.ServerRelativeUrl;

//====================================================================

// We do a couple of really important checks here.

// 1) If the site is the Portals site collection, DO NOT MOVE IT!!!

//    You cannot use STS backup/delete/restore on a Portal site collection

// 2) If the site is a portal MySite, DO NOT MOVE IT TO A DIFFERENT URL

//    See https://support.microsoft.com/?kbid=889236

//====================================================================

if(oldSite.RootWeb.WebTemplate.ToUpper().CompareTo("SPS")==0)

{

      Logging.Warning("You cannot repartition a portals site collection!");

      bContinue = false;

}

if(oldSite.RootWeb.WebTemplate.ToUpper().CompareTo("SPSPERS")==0)

{

      if(strSiteUrl.ToUpper().CompareTo(strRestoreURL.ToUpper())!= 0)

      {

             Logging.Warning("MySites cannot be relocated off the virtual server reside on, nor can the URL change during the operation");

             bContinue = false;

     }

//====================================================================

// Restore the site into the target databse on the target virtual server

//====================================================================

targetvs.Sites.Restore(strRestoreURL,strBackupFile,true);

js.ReinitVirtualServers();

From the SDK:, "The Restore method of the SPSiteCollection class restores a site object to the specified URL from the specified backup file."

Parameters:

strSiteUrl    A string that contains the URL to which to restore the site object.

The Restore() method requires the full absolute URL of the site, and that's working fine, but when I do the comparison check to ensure you're not moving a MySite between two different URLs, I'm comparing it to the relative version of the source URL.  The only problem here, is that this safety check for moving MySites, always prevents you from moving a MySite regardless.

I already have this corrected in version 2.3.


Problem 2

Again, I already have this corrected in version 2.3, but this one needs a full test pass before I release it.

JobSettings.cs GetSite()

Uses absolute URL when it should use Relative URL.

From the SDK: "The Item property of the SPSiteCollection class gets the site object at the specified server-relative URL from the collection."

Parameters

strSiteName   A string that contains the server-relative URL of the site object (for example, Site_Name or sites/Site_Name).

Absolute URLs are being passed into the GetSite() method.  The fact that it is actually allowing Absolute URLs is a bug IMHO, and I'll work to file this so that it gets corrected.  I’ve already corrected to trim the Scheme and Authority from the URL so that the server relative url is used, but since GetSite() is used all over the place, I need to do a full regression.  For the most part, this isn't causing a problem except when the Absolute URL of the site as stuffed into the FullUrl column in the Sites tables of your content databases, doesn't match.   Again, based on the documentation for this collection, it's expecting a relative URL anyways.


Once I finish doing a full test pass on this version of SPSiteManager, you should see it show up on the CodePlex project noted above.   Stay tuned to this channel for updates.

 - Keith