Creates a new site in the registry.
Syntax
DWORD WpCreateSite( LPTSTR szSiteName, LPTSTR szSiteLocalBaseDir, LPTSTR szSiteURL, LPTSTR szProviderCLSID, DWORD dwFlags );
Parameters
- szSiteName
- Posting site name.
- szSiteLocalBaseDir
- Optional. Local base directory for the site. If NULL, then the local base directory feature is not used for the site.
- szSiteURL
- Posting site URL.
- szProviderCLSID
- Optional. CLSID as string, of the provider that will handle this site. If NULL, then this method will search for a posting information (postinfo) file or attempt to autobind to an appropriate provider.
- dwFlags
- Optional. Action flags. Possible values are:
- WPF_USE_PROVIDER_PASSED
- If WpCreateSite has been called and returned WEBPOST_ERROR_PROV_NOT_IN_POSTINFO, use this flag to have WpCreateSiteEx use the provider specified in szProviderCLSID even if there is a postinfo file and it does not list this provider.
Return Value
Returns one of the following values:
NO_ERROR Successful. E_INVALIDARG One of the arguments is invalid. E_OUTOFMEMORY Not enough memory to create a new site in the registry. WEBPOST_ERROR_AUTOBIND_FAILED The Web Publishing API was unable to automatically determine which service provider to use for this site. WEBPOST_ERROR_CREATE_SITE An error occurred while the Web Publishing API was creating the requested site. WEBPOST_ERROR_EXTENDED_ERROR A Web Publishing extended error occurred. This means that the API received an error code that the API client may not be able to translate, so the API performed the translation and cached the error message for retrieval on a call to the WpGetErrorString method. WEBPOST_ERROR_INIT_FAILED An error occurred while attempting to initialize the Web Publishing API DLL. WEBPOST_ERROR_INVALID_POSTINFO Informational (nonfailure) result indicating that the postinfo file found on the server during site creation could not be parsed correctly. This error is only returned if the site creation is otherwise successful. WEBPOST_ERROR_NO_EXT_ERROR_INFO An extended error occurred in the Web Publishing API, but the error message could not be retrieved. WEBPOST_ERROR_NO_POSTINFO Informational (nonfailure) result indicating that the postinfo file could not be retrieved during a site creation. This error is only returned if the site creation is otherwise successful. WEBPOST_ERROR_POSTINFO_REQUIRED This service provider requires a postinfo file on the server, and none could be found. WEBPOST_ERROR_PROV_DLL The Web Publishing API could not load the DLL for one of its service providers. WEBPOST_ERROR_PROV_EP The Web Publishing API could not locate a required entry point in one of its service providers. WEBPOST_ERROR_SITE_EXISTS The Web Publishing API could not create the requested site because a site with the same name already exists.
Example
The following example calls WpCreateSite to create a new site in the registry.
{ HRESULT hResult = NOERROR; hResult = WpCreateSite("site1", NULL, "http://site1", NULL, 0); }
Function Information
Windows NT Use version 4.0 and later. Windows Use Windows 95 and later. Header Declared in Wpapi.h Import Library Link with WebPost.lib Minimum availability Internet Explorer 4.0