none
Importing CSV with 1 Projection Type class property, and several of my own, fails: "The element 'CSVImportFormat' has invalid child element 'Projection'."

    Question

  • Hi all,

    I'm probably missing something fundamentally when it comes to the format file for importing CSV.

    As I get this error message upon import:

    Creating new CSVImporter

     

    Data Filename: D:\PeterMP\VirtualServerUpoload.csv

    Format Filename: D:\PeterMP\VirtualServerUpload-Format.xml

     

    Validating against XSD schema...

    The element 'CSVImportFormat' has invalid child element 'Projection'.

    Validation completed.

     

    Expected one child node of type \"Component\" or \"Class\" under Component node

     

    Line number: 1, "font-family:'Courier New';">Could not initialize a Management Object Creator from format file D:\PeterMP\VirtualServerUpload-Format.xml. Import thread exiting.

    I have one property, AssetStatus, that I want to be a Projected Type System.ConfigItem.

    I have several of my own custom properties of class type VirtualServer.

    Here is my XML

    <CSVImportFormat>
        <Class Type="VirtualServer" >
            <Property ID="VirtualServerUploadID"   />
            <Property ID="NetbiosComputerName"   />
            <Property ID="PrincipalName"   />
            <Property ID="Environment"   />
            <Property ID="DisplayName"   />
            <Property ID="IPAddress"   />
            <Property ID="IsVirtualMachine"   />
            <Property ID="Region"   />
            <Property ID="Site"   />
            <Property ID="DomainDnsName"   />
            <Property ID="Product"   />
            <Property ID="Client"   />
            <Property ID="DNSName"   />
        </Class>
         <Projection Type="System.ConfigItem.Projection">
          <Seed>
            <Class Type="System.ConfigItem" >
                <Property ID="AssetStatus"   />
            </Class>
          </Seed>
         </Projection>
    </CSVImportFormat>
    

    Here is the original MP definition

    <?xml version="1.0"?>
    -<ManagementPack xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" OriginalSchemaVersion="1.1" SchemaVersion="2.0" ContentReadable="true"> -<Manifest> -<Identity> <ID>VirtualServerUpload</ID> <Version>1.0.0.0</Version> </Identity> <Name>VirtualServerUpload</Name> -<References> -<Reference Alias="System"> <ID>System.Library</ID> <Version>7.5.8501.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> -<Reference Alias="Console"> <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID> <Version>7.5.1561.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> -<Reference Alias="Alias_4e92bd7b_e193_4a74_a24b_e776bceb6c4f"> <ID>Microsoft.Windows.Library</ID> <Version>7.5.8501.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> </References> </Manifest> -<TypeDefinitions> -<EntityTypes> -<ClassTypes> -<ClassType Extension="false" Singleton="false" Hosted="false" Base="System!System.ConfigItem" Abstract="false" Accessibility="Public" ID="VirtualServer"> <Property ID="VirtualServerUploadID" DefaultValue="0" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="true" AutoIncrement="true" Type="string"/> <Property ID="NetbiosComputerName" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="PrincipalName" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="Environment" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="IPAddress" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="IsVirtualMachine" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="bool"/> <Property ID="Region" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="Site" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="DomainDnsName" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="Product" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="Client" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> <Property ID="DNSName" Scale="0" Required="false" MinLength="0" MaxLength="256" CaseSensitive="false" Key="false" AutoIncrement="false" Type="string"/> </ClassType> </ClassTypes> -<RelationshipTypes> -<RelationshipType Base="System!System.Reference" Abstract="false" Accessibility="Public" ID="NetbiosComputerName_RelationshipId_1"> <Source ID="Source_aee2c373_3e6a_4d7c_84b1_627b80018e06" Type="VirtualServer" MaxCardinality="2147483647" MinCardinality="0"/> <Target ID="Target_93fab1c2_86d8_4a80_bc38_37fcb30e6d4c" Type="Alias_4e92bd7b_e193_4a74_a24b_e776bceb6c4f!Microsoft.Windows.Computer" MaxCardinality="1" MinCardinality="0"/> </RelationshipType> -<RelationshipType Base="System!System.Reference" Abstract="false" Accessibility="Public" ID="IPAddress_RelationshipId_1"> <Source ID="Source_383eccf9_2144_4815_a117_65a9464ce13f" Type="VirtualServer" MaxCardinality="2147483647" MinCardinality="0"/> <Target ID="Target_f8e587f7_6642_4e8b_b018_e29aff088abc" Type="Alias_4e92bd7b_e193_4a74_a24b_e776bceb6c4f!Microsoft.Windows.Computer" MaxCardinality="1" MinCardinality="0"/> </RelationshipType> -<RelationshipType Base="System!System.Reference" Abstract="false" Accessibility="Public" ID="IsVirtualMachine_RelationshipId_1"> <Source ID="Source_2112060a_1395_4f82_833b_e746ce2e9b8c" Type="VirtualServer" MaxCardinality="2147483647" MinCardinality="0"/> <Target ID="Target_04b71565_847c_40ce_b538_2c448d84e389" Type="Alias_4e92bd7b_e193_4a74_a24b_e776bceb6c4f!Microsoft.Windows.Computer" MaxCardinality="1" MinCardinality="0"/> </RelationshipType> -<RelationshipType Base="System!System.Reference" Abstract="false" Accessibility="Public" ID="DomainDnsName_RelationshipId_1"> <Source ID="Source_16cb5560_c0be_40e8_a26f_0fc81965c6e8" Type="VirtualServer" MaxCardinality="2147483647" MinCardinality="0"/> <Target ID="Target_5eac3615_f6ad_4b88_99b6_8887e59bd79d" Type="Alias_4e92bd7b_e193_4a74_a24b_e776bceb6c4f!Microsoft.Windows.Computer" MaxCardinality="1" MinCardinality="0"/> </RelationshipType> -<RelationshipType Base="System!System.Reference" Abstract="false" Accessibility="Public" ID="Product_RelationshipId_1"> <Source ID="Source_51e1c5fb_60fa_4dd7_ac1c_d9db0a61b498" Type="VirtualServer" MaxCardinality="2147483647" MinCardinality="0"/> <Target ID="Target_4d9b6eee_d802_4356_b95f_f1d2c7a54835" Type="System!System.Entity" MaxCardinality="1" MinCardinality="0"/> </RelationshipType> -<RelationshipType Base="System!System.Reference" Abstract="false" Accessibility="Public" ID="Client_RelationshipId_1"> <Source ID="Source_9946a498_8e28_4949_9cb7_b6e481059edc" Type="VirtualServer" MaxCardinality="2147483647" MinCardinality="0"/> <Target ID="Target_5cb40163_a14a_461f_a431_d458ef7a7f76" Type="System!System.Entity" MaxCardinality="1" MinCardinality="0"/> </RelationshipType> -<RelationshipType Base="System!System.Reference" Abstract="false" Accessibility="Public" ID="DNSName_RelationshipId_1"> <Source ID="Source_2b6e22d6_8cb5_40d9_8c6a_06fbdaae6967" Type="VirtualServer" MaxCardinality="2147483647" MinCardinality="0"/> <Target ID="Target_c8f439bf_59f3_401f_9206_14829ca51c50" Type="Alias_4e92bd7b_e193_4a74_a24b_e776bceb6c4f!Microsoft.Windows.Computer" MaxCardinality="1" MinCardinality="0"/> </RelationshipType> </RelationshipTypes> </EntityTypes> </TypeDefinitions> -<Categories> -<Category ID="VirtualServerUpload.Category" Value="Console!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack"> <ManagementPackName>VirtualServerUpload</ManagementPackName> <ManagementPackVersion>1.0.0.0</ManagementPackVersion> </Category> </Categories> -<LanguagePacks> -<LanguagePack ID="ENU" IsDefault="true"> -<DisplayStrings> -<DisplayString ElementID="VirtualServerUpload"> <Name>VirtualServerUpload</Name> </DisplayString> -<DisplayString ElementID="VirtualServer"> <Name>VirtualServer</Name> <Description>Based on the abbreviated version of the Virtual Server Upload (version2)</Description> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="NetbiosComputerName"> <Name>NetbiosComputerName</Name> <Description>Net bios computer name</Description> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="VirtualServerUploadID"> <Name>VirtualServerUploadID</Name> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="PrincipalName"> <Name>PrincipalName</Name> <Description>Principal Name</Description> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="Environment"> <Name>Environment</Name> <Description>Environment</Description> </DisplayString> -<DisplayString ElementID="NetbiosComputerName_RelationshipId_1"> <Name>NetbiosComputerName_RelationshipId_1</Name> <Description>Netbios Computer Name (relationship)</Description> </DisplayString> -<DisplayString ElementID="NetbiosComputerName_RelationshipId_1" SubElementID="Source_aee2c373_3e6a_4d7c_84b1_627b80018e06"> <Name>Source_aee2c373_3e6a_4d7c_84b1_627b80018e06</Name> </DisplayString> -<DisplayString ElementID="NetbiosComputerName_RelationshipId_1" SubElementID="Target_93fab1c2_86d8_4a80_bc38_37fcb30e6d4c"> <Name>Target_93fab1c2_86d8_4a80_bc38_37fcb30e6d4c</Name> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="IPAddress"> <Name>IPAddress</Name> </DisplayString> -<DisplayString ElementID="IPAddress_RelationshipId_1"> <Name>IPAddress_RelationshipId_1</Name> </DisplayString> -<DisplayString ElementID="IPAddress_RelationshipId_1" SubElementID="Source_383eccf9_2144_4815_a117_65a9464ce13f"> <Name>Source_383eccf9_2144_4815_a117_65a9464ce13f</Name> </DisplayString> -<DisplayString ElementID="IPAddress_RelationshipId_1" SubElementID="Target_f8e587f7_6642_4e8b_b018_e29aff088abc"> <Name>Target_f8e587f7_6642_4e8b_b018_e29aff088abc</Name> <Description>IP Address relationship to Windows Computer Class</Description> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="IsVirtualMachine"> <Name>IsVirtualMachine</Name> </DisplayString> -<DisplayString ElementID="IsVirtualMachine_RelationshipId_1"> <Name>IsVirtualMachine_RelationshipId_1</Name> <Description>Renamed from IsVirtualServer, IsVirtualMachine relates to Windows.Computer</Description> </DisplayString> -<DisplayString ElementID="IsVirtualMachine_RelationshipId_1" SubElementID="Source_2112060a_1395_4f82_833b_e746ce2e9b8c"> <Name>Source_2112060a_1395_4f82_833b_e746ce2e9b8c</Name> </DisplayString> -<DisplayString ElementID="IsVirtualMachine_RelationshipId_1" SubElementID="Target_04b71565_847c_40ce_b538_2c448d84e389"> <Name>Target_04b71565_847c_40ce_b538_2c448d84e389</Name> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="Region"> <Name>Region</Name> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="Site"> <Name>Site</Name> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="DomainDnsName"> <Name>DomainDnsName</Name> </DisplayString> -<DisplayString ElementID="DomainDnsName_RelationshipId_1"> <Name>DomainDnsName_RelationshipId_1</Name> <Description>DomainDnsName is related to Windows Computer</Description> </DisplayString> -<DisplayString ElementID="DomainDnsName_RelationshipId_1" SubElementID="Source_16cb5560_c0be_40e8_a26f_0fc81965c6e8"> <Name>Source_16cb5560_c0be_40e8_a26f_0fc81965c6e8</Name> </DisplayString> -<DisplayString ElementID="DomainDnsName_RelationshipId_1" SubElementID="Target_5eac3615_f6ad_4b88_99b6_8887e59bd79d"> <Name>Target_5eac3615_f6ad_4b88_99b6_8887e59bd79d</Name> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="Product"> <Name>Product</Name> </DisplayString> -<DisplayString ElementID="Product_RelationshipId_1"> <Name>Product_RelationshipId_1</Name> </DisplayString> -<DisplayString ElementID="Product_RelationshipId_1" SubElementID="Source_51e1c5fb_60fa_4dd7_ac1c_d9db0a61b498"> <Name>Source_51e1c5fb_60fa_4dd7_ac1c_d9db0a61b498</Name> </DisplayString> -<DisplayString ElementID="Product_RelationshipId_1" SubElementID="Target_4d9b6eee_d802_4356_b95f_f1d2c7a54835"> <Name>Target_4d9b6eee_d802_4356_b95f_f1d2c7a54835</Name> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="Client"> <Name>Client</Name> </DisplayString> -<DisplayString ElementID="Client_RelationshipId_1"> <Name>Client_RelationshipId_1</Name> </DisplayString> -<DisplayString ElementID="Client_RelationshipId_1" SubElementID="Source_9946a498_8e28_4949_9cb7_b6e481059edc"> <Name>Source_9946a498_8e28_4949_9cb7_b6e481059edc</Name> </DisplayString> -<DisplayString ElementID="Client_RelationshipId_1" SubElementID="Target_5cb40163_a14a_461f_a431_d458ef7a7f76"> <Name>Target_5cb40163_a14a_461f_a431_d458ef7a7f76</Name> </DisplayString> -<DisplayString ElementID="VirtualServer" SubElementID="DNSName"> <Name>DNSName</Name> </DisplayString> -<DisplayString ElementID="DNSName_RelationshipId_1"> <Name>DNSName_RelationshipId_1</Name> </DisplayString> -<DisplayString ElementID="DNSName_RelationshipId_1" SubElementID="Source_2b6e22d6_8cb5_40d9_8c6a_06fbdaae6967"> <Name>Source_2b6e22d6_8cb5_40d9_8c6a_06fbdaae6967</Name> </DisplayString> -<DisplayString ElementID="DNSName_RelationshipId_1" SubElementID="Target_c8f439bf_59f3_401f_9206_14829ca51c50"> <Name>Target_c8f439bf_59f3_401f_9206_14829ca51c50</Name> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks> </ManagementPac

    Thursday, November 21, 2013 11:10 PM

Answers

  • Type Projections are a combination of class objects via relationships, so in this instance, you won't need projections in your CSV Import.

    Your VirtualServer class, by nature of class inheritance, automatically includes the "AssetStatus" property.

    Since you're only importing objects of your VirtualServer class, you can use a single-class import.

    This should be all you need:

    <CSVImportFormat>
        <Class Type="VirtualServer" >
            <Property ID="VirtualServerUploadID"   />
            <Property ID="NetbiosComputerName"   />
            <Property ID="PrincipalName"   />
            <Property ID="Environment"   />
            <Property ID="DisplayName"   />
            <Property ID="IPAddress"   />
            <Property ID="IsVirtualMachine"   />
            <Property ID="Region"   />
            <Property ID="Site"   />
            <Property ID="DomainDnsName"   />
            <Property ID="Product"   />
            <Property ID="Client"   />
            <Property ID="DNSName"   />
            <Property ID="AssetStatus" />
        </Class>
    </CSVImportFormat>
    

    Take a look at the following post/word document. It provides a lot of details about the CSV import feature including single-class object imports and type-projection imports.

    http://blogs.technet.com/b/servicemanager/archive/2009/05/26/using-the-csv-import-feature.aspx

    • Marked as answer by stuckip Friday, November 22, 2013 4:08 PM
    Friday, November 22, 2013 1:40 PM

All replies

  • Type Projections are a combination of class objects via relationships, so in this instance, you won't need projections in your CSV Import.

    Your VirtualServer class, by nature of class inheritance, automatically includes the "AssetStatus" property.

    Since you're only importing objects of your VirtualServer class, you can use a single-class import.

    This should be all you need:

    <CSVImportFormat>
        <Class Type="VirtualServer" >
            <Property ID="VirtualServerUploadID"   />
            <Property ID="NetbiosComputerName"   />
            <Property ID="PrincipalName"   />
            <Property ID="Environment"   />
            <Property ID="DisplayName"   />
            <Property ID="IPAddress"   />
            <Property ID="IsVirtualMachine"   />
            <Property ID="Region"   />
            <Property ID="Site"   />
            <Property ID="DomainDnsName"   />
            <Property ID="Product"   />
            <Property ID="Client"   />
            <Property ID="DNSName"   />
            <Property ID="AssetStatus" />
        </Class>
    </CSVImportFormat>
    

    Take a look at the following post/word document. It provides a lot of details about the CSV import feature including single-class object imports and type-projection imports.

    http://blogs.technet.com/b/servicemanager/archive/2009/05/26/using-the-csv-import-feature.aspx

    • Marked as answer by stuckip Friday, November 22, 2013 4:08 PM
    Friday, November 22, 2013 1:40 PM
  • Thanks for the clarification! I usually work on the SQL Database level where Foreign Key relationships are the usual mechanism along with joins and views to bring data together or to import it.

    Your answer made me realize that there is an Object Oriented paradigm at work, thus what you said helps in making that paradigm shift.

    Regards,

    Peter

    Friday, November 22, 2013 4:10 PM