This project is read-only.

Reused Terms at the root of a TermSet do not have 'reuse' flag applied during export


We ran into an issue during export/import of a term set that contained reused terms from another (already imported) term set. The tool would display this error message during import:
"Terms can not be shared multiple times in the same term set."
When we investigated, we saw that the import process would start altering the original term set (from where terms were being reused), rather than the importing term set. This behavior of course eventually triggered the SharePoint exception about sharing a term multiple times.

We finally figured out the export process was not marking all of the reused terms with the reuse flag. We tracked this behavior down to line 140 in XmlExportHelper.cs:
xmlWriter.WriteAttributeString("reuse", !term.IsRoot && term.IsReused ? "true" : "false");
This was excluding any terms that appeared at the root level of a term set. I'm sure there was a reason for writing it this way, but we have a lot of terms that are at the root and also reused. We fixed our problem by simply changing the line to:
xmlWriter.WriteAttributeString("reuse", term.IsReused ? "true" : "false");
Other than that, the tool works great and has been a great time-saver for us! Thank you for sharing it.