CheckSTSConnection Method

The CheckSTSConnection method uses WINHTTP to validate the connection to a given Web site running Microsoft Windows SharePoint Services. It verifies whether a given Windows SharePoint Services URL is correct and reachable by Microsoft Office Project Server.

Syntax

Function CheckSTSConnection(ByVal bstrAdminsStsUrl   As String, ByVal SessionID   As String, ByVal bstrValidator   As String) As Unsigned Long

Parameters

bstrAdminsStsUrl       Required. String that specifies the URL that one wants to check connection with.

SessionID       Required. String that specifies a valid Project Server session GUID.

bstrValidator       Required. String that specifies the Resource GUID stored in the Project Server database. This function call must be made by a valid Project Server user.

Return Values

Returns an integer representing one of the following error codes.

Error code Description
const_STS_ADMIN_ERROR_CANNOTSPLITURL The URL syntax is incorrect: cannot separate the protocol from the server name and server address.
const_STS_ADMIN_ERROR_URLNOTLONGENOUGH The URL is not long enough: its syntax is incorrect.
const_STS_ADMIN_ERROR_NOINETSESSION WinHTTP error - A session cannot be established.
const_STS_ADMIN_ERROR_NOINETCONNECTION WinHTTP error - No connection can be formulated.
const_STS_ADMIN_ERROR_NOINETREQUEST WinHTTP error - The request to the destination server cannot be formulated.
const_STS_ADMIN_ERROR_CANEEDED WinHTTP error - Client certificate is required because this URL uses SSL.
const_STS_ADMIN_ERROR_INVALIDSVRRESPONSE WinHTTP error - The server response is invalid.
const_STS_ADMIN_ERROR_SVRNAMENOTRESOLVED The server name running Windows SharePoint Services cannot be resolved correctly.
const_STS_ADMIN_ERROR_PROXYSVRNOTRESOLVED The proxy server name specified on Project Server cannot be resolved correctly.
const_STS_ADMIN_ERROR_CANNOTCONNECTTOSVR Failed when trying to connect to the Web site running Windows SharePoint Services.
const_STS_ADMIN_ERROR_SECUREFAILURE Failed when trying to authenticate to the Web site running Windows SharePoint Services.
const_STS_ADMIN_ERROR_WRONGPROXYSETTINGS Proxy server settings are not configured correctly on the Project Server.
const_STS_ADMIN_ERROR_WRONGCOMPLUSACCOUNT The COMPlus account does not have permissions to the administrative site of Windows SharePoint Services.

Example

The following function in stsmodsv.asp shows the usage of PSStSAdm object and its method. The function validates the administrative URL and Web URL of a given server running Windows SharePoint Services.

  function ValidateSTS(sAdminServerName, sStsWebUrl, sStsAdminUrl, sManagedPath, sPublicSiteName, sSTSNetBiosName)

{

  oAdmObj     = Server.CreateObject("PjObjProv.PSStsAdm");

  oCommonUtil = Server.CreateObject("Pjsvrutl.PjCommonUtil");

 

  //  (1.1, 1.2, 1.3, 1.4) validate whether the STS server box is reachable over the network.

  //

  var nErr = CheckSTSConnection(sStsAdminUrl);

  if(nErr > 0)

  {

    return nErr;

  }

 

  //  1.5 validate Web server url for proxy settings in case admin site is in NETBIOS

  //      and Web sites are in IP notation.

  nErr = CheckSTSConnection(sStsWebUrl);

  if(nErr > 0)

  {

    return nErr;

  }

 

  // 3.1 Validate that template ID 6215 exist on the STS server.

  //

  nErr = CheckSiteTemplates(sStsWebUrl, oLocalizedStrings.sLCID);

  if(nErr > 0)

  {

    return nErr;

  }

 

  // 3.2 Send admin XMLHTTP call to create a site (use a GUID as a name).

  //

  // We use a GUID as a test project name.

  var sTestSubwebName = "MS_PWA11_" + oCommonUtil.GenerateGUID();

  nErr = ValidateAdminCreateSite(sAdminServerName, sStsAdminUrl, sStsWebUrl, sManagedPath, sTestSubwebName, sSTSNetBiosName);

  if(nErr > 0)

  {

    DeleteSite(sStsAdminUrl, sStsWebUrl, sManagedPath, sTestSubwebName);

    return nErr;

  }

 

  // 3.3 Validate whether the site contains document, issue and risk lists.

  // 3.4 And whether the site has been created using our template.

  //

  nErr = ValidateSiteSchema(sStsWebUrl, sManagedPath, sTestSubwebName, false);

  if(nErr > 0)

  {

    DeleteSite(sStsAdminUrl, sStsWebUrl, sManagedPath, sTestSubwebName);

    return nErr;

  }

 

  // 3.5 Validate whether the site properties are set correctly.

  //

  nErr = CheckSiteProperties(sStsWebUrl, sManagedPath, sTestSubwebName, sStsAdminUrl);

  if(nErr > 0)

  {

    DeleteSite(sStsAdminUrl, sStsWebUrl, sManagedPath, sTestSubwebName);

    return nErr;

  }

 

  // 3.6 Delete the site.

  //

  DeleteSite(sStsAdminUrl, sStsWebUrl, sManagedPath, sTestSubwebName);

 

  // From this point on we can save changes even if the test fails.

  bCanSave = true;

 

  // 4.1 Validate whether the public was created from our templates.

  //

  nErr = ValidateSiteSchema(sStsWebUrl, sManagedPath, sPublicSiteName, true);

  if(nErr > 0)

  {

    return nErr;

  }

 

  // Here we set the site properties for Public Documents.

  var sPublicUrl = sStsWebUrl;

  if(sManagedPath && (sManagedPath != ""))

  {

    sPublicUrl += "/" + sManagedPath;

  }

  sPublicUrl += "/" + sPublicSiteName;

 

  SetPublicStsSiteVariables(sPublicUrl, sStsAdminUrl);

 

  return const_S_NOERROR;

 

} // End of ValidateSTS().


Applies To

IPSSTSAdm Interface

Additional Information

Object Link Provider Reference for Microsoft Office Project Server

Object Link Provider Concepts and Architecture