• setting properties null exception

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #29507  by monisha3107
 
I am having problems using set properties for a particular document using the OpenKM web service.

So when I do webservice.setPropeties(path, groupname, PropertiesMap)

I get the exception "object reference not set to an instance of an object" although the PropertiesMap (an OKMFormElementBean[] object) is not null.

Really appreciate any help I can get. Kinda stuck on this from weeks.

Thanks
 #29529  by jllort
 
You're using c# no ? can you paste here some code ( sample ) to see what and how are you trying ?
 #29533  by monisha3107
 
Yes c#. Pasted below.
Code: Select all
OKMWebservice ws = OKMWebServiceFactory.getInstance(host, username, password, OKMWebServiceFactory.PROFESSIONAL_6_4_9);
String uuid = ws.getNodeUuid(defaultdirectory + filename);
String path = ws.getNodePath(uuid);
String grpname = refname;
Dictionary<String,String> metadata = new Dictionary<String,String>();
OKMFormElementBean[] propertiesMap = ws.getProperties(path, grpname);
String[] lines = System.IO.File.ReadAllLines( "metadata.txt");
foreach (String line in lines)
 {
       string[] parts = line.Split(',');
       metadata.Add(parts[0],parts[parts.Length-1]);
 }
 for(int i =0; i < propertiesMap.Length; i++)
 {
         String type =  propertiesMap[i].getType();
         switch (type)
                           {
                               case "text":
                                   propertiesMap[i].setValue(metadata[propertiesMap[i].getName()]);
                                   break;
                               case "multiple":
                                   OKMOptionBean[] option = propertiesMap[i].getOptions();
                                   String[] multiple = metadata[propertiesMap[i].getName()].Split(' ');
                                   for (int j = 0; j < multiple.Length; j++)
                                   {
                                       if (values.ContainsKey(multiple[j]))
                                       {
                                           option[j].setLabel(multiple[j]);
                                           option[j].setValue(values[multiple[j]]);
                                       }

                                   }
                                   propertiesMap[i].setOptions(option);
                                   break;
                           }
                        }
 ws.addGroup(path, grpname);
 ws.setProperties(path, grpname, propertiesMap); --------------------------> here's where I get the exception
                    }
 #29544  by jllort
 
What openkm version are you using ? 6.4.X trial version, professional version or community version ?
I suggest use setPropertiesSimple
Code: Select all
void setPropertiesSimple(String nodePath, String grpName, Dictionary<String, String> propertiesMap);
void setPropertiesSimple(String token, String nodePath, String grpName, Dictionary<String, String> propertiesMap);
You'll get less problems with it
 #29549  by monisha3107
 
I am using OpenKM 6.4 professional

I did use setPropertiesSimple and it works only for "TEXT" field. If I have a control of type "Select" (listbox or combobox - where i can select multiple or single values) , it doesn't work with setPropertiesSimple.

Do you know how I can handle that?
 #29562  by jllort
 
If you are OpenKM customer you must do this kind of questions from OpenKM customer website. I've send you a private message.

In case multiple, you must pass values separated by ";". I revised the source code and I think could be a bug when you're doing the call from soap and rest services. Seems was wrong in soap and when we had done with rest we propagated the bug also. Anyway contact us as a customer in our support customer website.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.