Loading Objects with Security Labels Using a CSV File
To load a data with security labels using a CSV file, add the securityLabels attribute for an object as a string containing a slash (/) separated list of security label name/value pairs, where the names and values are the same as those specified in the security labels configuration file and are separated by an equal (=) sign, without an extraneous white space. Once you convert the CSV file to XML, the XML file will contain a csvsecurityLabels element with its value set to the same string as specified in the CSV file. The location of the element depends on the DTD definition for the object type. The DTD definitions can be found in the <Windchill>/codebase/registry/ixb/dtds/standardX20.dtd directory, where <Windchill> is the location where Windchill is installed.
The following is an example of the CSV file format for a document with multiple security labels.
Document,,ImportDoc1,Imported Document,48124,Document,descriptive text,DESIGN,/Default/Folder1,,,Basic,,,ApplicationData,EGadWork.xls,,,A,1,CORPORATE_PROPRIETARY=PRV/EXPORT_CONTROL=DNE/THIRD_PARTY_PROPRIETARY=CompanyA
Using the CSV2XML utility, convert your CSV file to XML for loading. The resulting XML file should look like the following example. For more information on the CSV2XML utility, see About the CSV2XML Utility.
<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX20.dtd">
<NmLoader>
<csvDocument handler="wt.doc.LoadDoc.createGeneral" >
<csvuser></csvuser>
<csvname>ImportDoc1</csvname>
<csvtitle>Imported Document</csvtitle>
<csvnumber>48124</csvnumber>
<csvtype>Document</csvtype>
<csvdescription>descriptive text</csvdescription>
<csvdepartment>DESIGN</csvdepartment>
<csvsaveIn>/Default/Folder1</csvsaveIn>
<csvteamTemplate></csvteamTemplate>
<csvdomain></csvdomain>
<csvlifecycletemplate>Basic</csvlifecycletemplate>
<csvlifecyclestate></csvlifecyclestate>
<csvtypedef></csvtypedef>
<csvprimarycontenttype>ApplicationData</csvprimarycontenttype>
<csvpath>EGadWork.xls</csvpath>
<csvformat></csvformat>
<csvcontdesc></csvcontdesc>
<csvversion>A</csvversion>
<csviteration>1</csviteration>
<csvsecurityLabels>CORPORATE_PROPRIETARY=PRV/EXPORT_CONTROL=DNE/THIRD_PARTY_PROPRIETARY=CompanyA</csvsecurityLabels>
</csvDocument>
</NmLoader>
After creating your XML load file, run the following command in a windchill shell:
windchill wt.load.LoadFromFile -d Load File Location -u username -p password -CONT_PATH \"/Context Type=Context Name\"
Where Load File Location is the location where your load file is saved, username is your username, password is your password, Context Type is the type designation of the context where you are loading your object, and Context Name is the name of the context where you are loading your object. Objects loaded into an application context must have both the organization context and the application context listed separated by a forward slash (/).
For example, to load a file to the Golf Cart product, run the following command:
windchill wt.load.LoadFromFile -d D:/LoadObjects/csvloadfile.xml -u bfa -p bfa -CONT_PATH \"/wt.inf.container.OrgContainer=Demo Organization/wt.pdmlink.PDMLinkProduct=Golf Cart\"
For more information about using a CSV file to load data, including how to use the CSV2XML utility, see About the CSV2XML Utility.
Was this helpful?