Posts files and directories to a desired site.
Syntax
DWORD WpPost( HWND hWnd, DWORD dwNumLocalPaths, LPTSTR *pszLocalPaths, LPDWORD pdwSiteNameBufLen, LPTSTR szSiteName, LPDWORD pdwDestURLBufLen, LPTSTR szDestURL, DWORD dwFlags );
Parameters
- hWnd
- Optional. Window handle to receive focus upon completion of this API call. This can be NULL.
- dwNumLocalPaths
- Number of elements in the array pointed to by pszLocalPaths.
- pszLocalPaths
- String names of files or directories to be posted. If the string specifies a directory (and the WPF_NO_RECURSIVE_POST flag is not set in the dwFlags parameter), all the files in that directory are posted.
- pdwSiteNameBufLen
- Size, in bytes, of buffer szSiteName. On return, contains the actual number of bytes used in szSiteName. If szSiteName is NULL or too small, this parameter shows the necessary size of the buffer to allocate.
- szSiteName
- Posting site name. This parameter and the szDestURL parameter cannot both be NULL or empty if the WPF_NO_WIZARD flag is set.
- pdwDestURLBufLen
- Size, in bytes, of buffer szDestURL. On return, contains the actual number of bytes used in szDestURL. If szDestURL is NULL or too small, this parameter shows the necessary size of the buffer to allocate.
- szDestURL
- Destination URL. If this parameter is non-NULL and of sufficient size, and the WPF_NO_WIZARD flag is not set, then on return it will contain the destination URL for the site.
- dwFlags
- Action flags. Possible values are shown in the following list.
- WPF_FIRST_FILE_AS_DEFAULT
- Take the first file specified in pszLocalPaths as the file that will be shown as the default page.
- WPF_NO_RECURSIVE_POST
- If any element in pszLocalPaths points to a directory, do not post files recursively.
- WPF_NO_WIZARD
- Do not prompt the user for any input.
- WPF_NO_DIRECT_LOOKUP
- Do not attempt to look up the site based on the site name. This has the same effect as a NULL or empty szSiteName.
- WPF_NO_URL_LOOKUP
- Do not attempt to look up the site based on the site URL. This has the same effect as a NULL or empty szSiteURL.
- WPF_NO_PROGRESS_DLGS
- Do not show the "Publishing files" progress bar during the transfer of files to the destination computer.
- WPF_NO_UI
- Predefined combination of WPF_NO_WIZARD and WPF_NO_PROGRESS_DLGS.
- WPF_SHOWPAGE_WELCOME
- Forces the wizard to display the initial Publish Your Files on the Web page. Normally this page is skipped if the only other page being displayed is the Finish page. Note that the WPF_NO_WIZARD flag overrides this one.
- WPF_SHOWPAGE_SRCFILE
- Forces the wizard to display the Select a File or Folder page. Normally this page is skipped if the path or paths to publish are specified in the call to WpPost. Note that the WPF_NO_WIZARD flag overrides this one.
- WPF_SHOWPAGE_DESTSITE
- Forces the wizard to display the Select a Web Server page. Normally this page is skipped if the site name is specified in the call to WpPost. Note that the WPF_NO_WIZARD flag overrides this one.
- WPF_SHOWPAGE_PROVIDER
- Forces the wizard to display any and all pages associated with the service provider. Note that it is the responsibility of service provider implementations to be compliant with this flag (see the specification for the AddWizardPages SPI method.) Note that the WPF_NO_WIZARD flag overrides this one.
- WPF_SHOWPAGE_ALL
- Predefined combination of WPF_SHOWPAGE_*. Note that the WPF_NO_WIZARD flag overrides this one.
Return Value
Returns one of the following values:
NO_ERROR Successful. WEBPOST_ERROR_COCREATE_WIZARD The Web Publishing API could not invoke the Web Publishing Wizard. 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_HTTP_GET_FAILED Informational (nonfailure) result indicating failure in the attempt to retrieve one of the published files with an HTTP GET. This error is only returned in cases where the files were all successfully uploaded. WEBPOST_ERROR_INIT_FAILED An error occurred while attempting to initialize the Web Publishing API DLL. 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_POST_FILES An error occurred while the Web Publishing API was attempting to post the requested files. WEBPOST_ERROR_PROV_QI The Web Publishing API was unable to determine what interface is exported by the specified service provider.
Remarks
The following two tables show the effect of setting (or not setting) the WPF_NO_Wizard flag. The horizontal axes of the tables display values for the szDestURL parameter, and the vertical axes display values for the szSiteName parameter. The tables show what the WpPost function does given these parameters.
The dwFlags parameter has the WPF_NO_WIZARD flag set.
szDestURL == NULL szDestURL == existing site Y szDestURL is prefixed by an existing site Y szDestURL is new szSiteName == NULL Returns E_INVALIDARG Posts to site Y Posts to site Y; publishes to URL szDestURL Creates a new site szSiteName == existing site X Posts to site X If X == Y, posts to that site; otherwise, returns E_INVALIDARG If X == Y, posts to that site and publishes to URL szDestURL; otherwise, returns E_INVALIDARG Returns E_INVALIDARG szSiteName is new Returns E_INVALIDARG Creates a new site Creates a new site Creates a new site The dwFlags parameter does not have the WPF_NO_WIZARD flag set.
szDestURL == NULL szDestURL == existing site Y szDestURL is prefixed by an existing site Y szDestURL is new szSiteName == NULL Creates a new site; displays all wizard pages Posts to site Y; displays Welcome and Finish wizard pages Posts to site Y; publishes to URL szDestURL; displays Welcome and Finish wizard pages Creates a new site; displays all wizard pages except URL szSiteName == existing site X Posts to site X; displays Welcome and Finish wizard pages Posts to site X; displays Welcome and Finish wizard pages Posts to site X; displays Welcome and Finish wizard pages Posts to site X; displays Welcome and Finish wizard pages szSiteName is new Creates a new site; displays all wizard pages except Name the Web Server Creates a new site; displays all wizard pages except Name the Web Server and URL Creates a new site; displays all wizard pages except Name the Web Server and URL Creates a new site; displays all wizard pages except Name the Web Server and URL If the wizard is invoked (the WPF_NO_WIZARD flag is not set), the wizard will examine the information specified in the call to WpPost and display the minimum set of pages necessary to complete the publishing process (this minimum UI behavior may be overridden with the WPF_SHOWPAGE flags.) If the user is prompted to enter the friendly name and/or URL for the site, this information is returned to the caller of WpPost in the buffers provided.
If the wizard is not invoked, WpPost calls WpBindToSite to get an interface pointer to the provider that owns the specified site. If the WpBindToSite call fails, WpPost tries to create the site by calling WpCreateSite. Note that WpPost passes the destination URL to WpBindToSite and WpCreateSite. When calling WpCreateSite, it also passes NULL for the local base directory, indicating that this site does not use the local base directory feature and that all posts to this site should go to the root destination URL; and it passes NULL for the service provider, specifying that the service provider should be determined by autobinding. If the site's provider cannot be determined from the site name passed to WpPost or an autobind, WpPost will fail.
Since WpPost relies on WpBindToSite to do site lookup, all site lookup functionality resides within WpBindToSite. The procedure followed when performing this lookup is detailed under WpBindToSite.
Example
The following example shows how to call WpPost to post files and directories to a site.
{ HRESULT hResult = NOERROR; LPTSTR szLocalPaths = {"c:\\MyDir"}; hResult = WpPost(NULL, 1, &szLocalPaths, 0, NULL, 0, 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