Contents Index Topic Contents | ||
Previous Topic: WpListSites Next Topic: WpPostEx |
WpPost
DWORD WpPost( [in] HWND hWnd [in] DWORD dwNumLocalPaths [in] LPTSTR * pszLocalPaths [in, out] LPDWORD pdwSiteNameBufLen [in, out] LPTSTR szSiteName [in, out] LPDWORD pdwDestURLBufLen [in, out] LPTSTR szDestURL [in] DWORD dwFlags );Posts files and directories to a desired site.
- Returns NO_ERROR if successful. Otherwise, returns an error code, which may be one of the following:
WEBPOST_ERROR_INIT_FAILED WEBPOST_ERROR_PROV_QI WEBPOST_ERROR_POST_FILES WEBPOST_ERROR_INIT_FILES WEBPOST_ERROR_COCREATE_WIZARD WEBPOST_ERROR_HTTP_GET_FAILED WEBPOST_ERROR_EXTENDED_ERROR WEBPOST_ERROR_NO_EXT_ERROR_INFO For further information on error codes, see Appendix B, Error Codes.
- hWnd
- Optional. Window handle to receive focus upon completion of this API call. May 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
- The posting site name. This parameter and the szDestURL parameter may not 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
- The 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 table.
Value Meaning 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 of the AddWizardPages SPI function.) 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. The following tables explain how whether dwFlags has the WPF_NO_WIZARD flag set and the various values of the szSiteName and the szDestURL parameters affect what WpPost does.
dwFlags 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 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 dwFlags 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 WpBindToSiteand 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 auto-binding. If the site's provider cannot be determined from the site name passed to WpPost or an auto-bind, 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.
Examples
C/C=++{ HRESULT hResult = NOERROR; LPTSTR szLocalPaths = {"c:\\MyDir"}; hResult = WpPost(NULL, 1, &szLocalPaths, 0, NULL, 0, NULL, 0); }
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.