Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Null Error Setting Property Values

2 REPLIES 2
Reply
Message 1 of 3
meck
345 Views, 2 Replies

Null Error Setting Property Values

I've been fighting with this for 2 days now searching and reading, but to no avail. So someone please help me. All I want to do is set the value of some UPDs in a file that is in that vault. When I run the code below I get...

ArgumentNullException was Unhandled

Value cannot be Null

Parmeter Key Name

 

This occurs on the vaultExplorer.UpdateFileProperties(oFile, Props) line of code. The array that supplies the values (MetaData) has no Null elements.

 

Here is the whole thing:

       

Dim aryPropIDs() AsInteger = {136, 82, 51, 116, 133, 134, 135, 101, 117}

Dim aryPropNames() AsString = {"Rev", "Title", "State", "Initial Release Date", "Dwg Size", "Content", "Component No", "Project", "Unit Type"}

       

Dim i AsInteger = 0

       

Dim Props AsNew System.Collections.Generic.Dictionary(OfPropDef, Object)

       

For i = 0 To 8

           

'Ignor the file State

           

If i <> 2 Then

               

Try

                   

Dim obj AsNewPropDef

                    obj.Id = aryPropIDs(i)

                   

If i = 3 And MetaData(i) <> ""Then

                       

'Create a date object

                       

Dim RelDate AsNewDate

                        RelDate = MetaData(i)

                        obj.DfltVal = RelDate

                        Props.Add(obj, aryPropNames(i))

                   

Else

                       

'Update Properties:

                        obj.DfltVal = MetaData(i)

                        Props.Add(obj, aryPropNames(i))

                       

If i = 1 Then

                           

'Put Title value in Description Also

                           

Dim oDesc AsNewPropDef

                            oDesc.Id = 90

                            oDesc.DfltVal = MetaData(i)

                            Props.Add(oDesc,

"Description")

                       

EndIf

                   

EndIf

               

Catch

                    ChkInError = ChkInError & vbNewLine &

"Error updating property " & i & ": " & aryPropNames(i)

                    ErrorOccured =

True

                    PropUpdated =

False

               

EndTry

           

EndIf

       

Next

        vaultExplorer.UpdateFileProperties(oFile, Props)

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
2 REPLIES 2
Message 2 of 3
wayne.brill
in reply to: meck

Hi Mike,

 

I don't see what is wrong looking at the code example. Can you send me a small but buildable example I could use to test this? Also what version of Vault are you running?


Did you see the example in this blog post?

http://adndevblog.typepad.com/manufacturing/2013/07/vault-2014-iexplorerutil-vb-example.html
 
Can you edit that example to work with the file and property in your vault and let me know the results you get? 

 

Thanks,

Wayne

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
meck
in reply to: wayne.brill

My appologies Wayne. I am currently on the road and have not had access to the files to give you an example. The files are of 2 types pdf and tif. I am using Vault Pro 2013.

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report