<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create items with UDPs via API in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/create-items-with-udps-via-api/m-p/7258465#M7272</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have some problems to fill item UDPs automatically.&lt;BR /&gt;My program imports items to VaultProf 2017 from a csv-file with individual number, title and title2 (UDP).&lt;BR /&gt;The import works fine, the items are generated but filling the UDP 'title2' fails.&lt;BR /&gt;( I tried the code from this post: &lt;A href="https://forums.autodesk.com/t5/vault-customization/2015-r2-updateitemproperties/td-p/5461108" target="_blank"&gt;https://forums.autodesk.com/t5/vault-customization/2015-r2-updateitemproperties/td-p/5461108&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is my code snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Create Item
Item item = itemSvc.AddItemRevision(catID);
item.ItemNum = myItemNumberString;
item.Title = lineOfCsv[1].ToString();
itemService.UpdateAndCommitItems(new Item[] { item });&lt;BR /&gt;
// Update UDP -&amp;gt; numberPropDefinition is the id of UDP 'title2' from PropertyService
itemService.UpdateItemProperties(
  new long[] { item.RevId },
  new PropInstParamArray[] {
    new PropInstParamArray() {
      Items=new PropInstParam[] {
        new PropInstParam() { PropDefId=numberPropDefinition.Id, Val=lineOfCsv[2].ToString() }
      }
    }
  }
);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The result:&lt;BR /&gt;The items are generated with correct Number, Title and Category (first program part)&lt;BR /&gt;But after the second program part the item has lost his category and the UDP title2 isn't filled out !??&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Jens&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2017 14:23:46 GMT</pubDate>
    <dc:creator>Jens.Bruhn</dc:creator>
    <dc:date>2017-07-27T14:23:46Z</dc:date>
    <item>
      <title>Create items with UDPs via API</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/create-items-with-udps-via-api/m-p/7258465#M7272</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have some problems to fill item UDPs automatically.&lt;BR /&gt;My program imports items to VaultProf 2017 from a csv-file with individual number, title and title2 (UDP).&lt;BR /&gt;The import works fine, the items are generated but filling the UDP 'title2' fails.&lt;BR /&gt;( I tried the code from this post: &lt;A href="https://forums.autodesk.com/t5/vault-customization/2015-r2-updateitemproperties/td-p/5461108" target="_blank"&gt;https://forums.autodesk.com/t5/vault-customization/2015-r2-updateitemproperties/td-p/5461108&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is my code snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Create Item
Item item = itemSvc.AddItemRevision(catID);
item.ItemNum = myItemNumberString;
item.Title = lineOfCsv[1].ToString();
itemService.UpdateAndCommitItems(new Item[] { item });&lt;BR /&gt;
// Update UDP -&amp;gt; numberPropDefinition is the id of UDP 'title2' from PropertyService
itemService.UpdateItemProperties(
  new long[] { item.RevId },
  new PropInstParamArray[] {
    new PropInstParamArray() {
      Items=new PropInstParam[] {
        new PropInstParam() { PropDefId=numberPropDefinition.Id, Val=lineOfCsv[2].ToString() }
      }
    }
  }
);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The result:&lt;BR /&gt;The items are generated with correct Number, Title and Category (first program part)&lt;BR /&gt;But after the second program part the item has lost his category and the UDP title2 isn't filled out !??&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Jens&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 14:23:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/create-items-with-udps-via-api/m-p/7258465#M7272</guid>
      <dc:creator>Jens.Bruhn</dc:creator>
      <dc:date>2017-07-27T14:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create items with UDPs via API</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/create-items-with-udps-via-api/m-p/7268378#M7273</link>
      <description>&lt;P&gt;Hi Jens,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;STRONG&gt;UpdateItemProperties&lt;/STRONG&gt; API returns an array of items.&amp;nbsp; Can you try calling the &lt;STRONG&gt;UpdateAndCommitItems&lt;/STRONG&gt; API&amp;nbsp;on that.&lt;/P&gt;
&lt;P&gt;So your code would be something like below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// Create Item
Item item = itemSvc.AddItemRevision(catID);
item.ItemNum = myItemNumberString;
item.Title = lineOfCsv[1].ToString();
itemService.UpdateAndCommitItems(new Item[] { item });

// Update UDP -&amp;gt; numberPropDefinition is the id of UDP 'title2' from PropertyService


Item[] updated_items = 

itemService.UpdateItemProperties(
  new long[] { item.RevId },
  new PropInstParamArray[] {
    new PropInstParamArray() {
      Items=new PropInstParam[] {
        new PropInstParam() { PropDefId=numberPropDefinition.Id, Val=lineOfCsv[2].ToString() }
      }
    }
  }
);

connection.WebServiceManager.ItemService.UpdateAndCommitItems( updated_items);
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sajith&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 13:09:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/create-items-with-udps-via-api/m-p/7268378#M7273</guid>
      <dc:creator>sajith_subramanian</dc:creator>
      <dc:date>2017-08-01T13:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create items with UDPs via API</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/create-items-with-udps-via-api/m-p/7269696#M7274</link>
      <description>&lt;P&gt;Hi Sajith,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so it works fine!&lt;/P&gt;&lt;P&gt;Thanx a lot for your help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jens&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 22:02:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/create-items-with-udps-via-api/m-p/7269696#M7274</guid>
      <dc:creator>Jens.Bruhn</dc:creator>
      <dc:date>2017-08-01T22:02:47Z</dc:date>
    </item>
  </channel>
</rss>

