Is -Force really used on an Import-SPWeb command? If so then what does it do? I understand the use on the Export-SPWeb command but it's not really clear on the import side.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@officedocsbot assign @yogkumgit
Hello @esammann thanks for your feedback.
The article includes the description of the force parameter as _Forcefully overwrites the export package if it already exists._ and that is what it does.
Does that answers your question?
Thank you
@get-itips Thank you very much for the contribution and updating the documentation with PR. @esammann Hope this update is helpful for you. Thanks for taking out some time to open the issue. Appreciate and encourage you to do the same in future also.
@officedocsbot close
Hello @get-itips and @yogkumgit
I would have to say that doesn't answer my question. The -Force makes sense on the Export-SPWeb because it will overwrite a previously exported package if one was previously exported to the same location. However, Import-SPWeb doesn't export anything, therefore there is no export package to overwrite. It doesn't seem like this parameter makes sense here.
If the -Force were to overwrite a SharePoint site then that might make sense. However, that seems to be handled with the -UpdateVersions flag. Therefor the -Force parameter on the Import-SPWeb is confusing.
Thanks,
Hello @Techwriter40 how are you?
The description for -Force parameter in Import-SPWeb cmdlet's article seems to have been copied from Export-SPWeb cmdlet's article, can you confirm please the use of -Force parameter in Import-SPWeb? I pulled my lab and could not find any difference using -Force parameter. Thanks
@Techwriter40 Please reply to Andres's question
I checked a TDS build of SharePoint Server 2016. The Force parameter does exist and is part of the syntax.
Exactly @Techwriter40 that has already been verified by me, the cmdlet includes the Force parameter but the Force parameter does nothing actually and the description on the article is not accurate too. Please check. Thanks
@Techwriter40 kindly confirm Force parameter is working or not and does this documentation needs to be updated?
Gentle reminder @Techwriter40 kindly confirm Force parameter is working or not and does this documentation needs to be updated?
Hello @Techwriter40 kindly tell me if you have seen my comment about Force parameter current behavior thanks.
Hello @Techwriter40 kindly tell me if you have seen my comment about Force parameter current behavior thanks.
Based on a decompile, I don't see that -Force is referenced at all. Part of the structure of these cmdlets is that they inherit from a common base class, which does have the -Force parameter. The base class is used for both Export and Import cmdlets.
bool flag = File.Exists(settings.LogFilePath) && !(this is SPCmdletImportWeb);
if ((this.Force == 0) && flag) [...]
This is the only reference to the -Force switch that I can see. This basically sets a flag that indicates if the log file exists _and_ this isn't the import cmdlet, then if -Force is not specified (equals 0) and the flag is true (due to a log file existing), it will error out -- for the _export_ cmdlet only.
Many Thanks @tseward for that information, so that I think, reinforces my conclusion.
@trent-green Will you be able to please help us here.
Please just remove the -Force switch from this documentation as is must have been copied over from Export-SPWeb, but it serves no purpose on Import-SPWeb since an export package is not created, and is therefor impossible to overwrite an existing export package.
Not quite. The documentation isn't a copy -- Import-SPWeb and Export-SPWeb both have the -Force parameter. This means that this would need to be resolved in the product prior to the document. With that said, what can be done is the documentation can be updated to indicate that this parameter has no effect.
@tseward Thank you very much for the contribution and updating the documentation with PR. @esammann Hope this update is helpful for you. Thanks for taking out some time to open the issue. Appreciate and encourage you to do the same in future also.