Publishes a Web site to a Web server.
expression.Publish(DestinationUrl, PublishFlags, UserName, Password)
expression An expression that returns a WebEx object.
DestinationUrl Required String. A string that contains the entire target URL for the Web site, such as “http://wwwroot/Adventure Works”. This can be any URL for a Web site, such as http://web server /folder or file://file system /folder for disk-based Web sites.
PublishFlags Optional FpWebPublishFlags.
FpWebPublishFlags can be one of these FpWebPublishFlags constants. |
fpPublishAddToExistingWeb |
fpPublishCopyAllFiles |
fpPublishCopySubwebs |
fpPublishIncremental |
fpPublishLogInTempDir |
fpPublishNoDeleteUnmatched |
fpPublishUseLastPublishTime |
fpPublishNone default |
UserName Optional String. The name of the user who is publishing the Web site.
Password Optional String. The password of the user.
Note Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.
Example
The following example publishes the active Web site.
Note If the Web site you are publishing to is an existing Web site, you must use the argument fpPublishAddToExistingWeb, otherwise your Web site won't be published. If the Web site you are publishing to doesn't exist, don't use the fpPublishAddToExistingWeb argument because your Web site won't be published.
Private Sub PublishMyWeb()
Dim myWeb As WebEx
Dim myBaseURL As String
Dim myPublishParam As FpWebPublishFlags
Set myWeb = Application.ActiveWeb
myBaseURL = "http://www.Adventure-Works.com"
myPublishParam = fpPublishAddToExistingWeb
myWeb.Publish myBaseURL, myPublishParam
End Sub