Difference between revisions of "Csharp utils dll"
From OpenKM Documentation
(→ConfigXML) |
|||
Line 12: | Line 12: | ||
ConfigXML helps on manage openkm.xml file stored at MyDocuments/OpenKM to keep application configuration parameters. First time is called ConfigXML if MyDocuments/OpenKM/openkm.xml configuration file not exists create one with default values. | ConfigXML helps on manage openkm.xml file stored at MyDocuments/OpenKM to keep application configuration parameters. First time is called ConfigXML if MyDocuments/OpenKM/openkm.xml configuration file not exists create one with default values. | ||
− | Example of use: | + | '''Example openkm.xml file:''' |
+ | <source lang="xml"> | ||
+ | <?xml version="1.0"?> | ||
+ | <openkm> | ||
+ | <host>http://192.168.1.34:8180/OpenKM/</host> | ||
+ | <user>okmAdmin</user> | ||
+ | <password>1HpkvlY72ks=</password> | ||
+ | <version>2</version> | ||
+ | <idioma>enGB</idioma> | ||
+ | </openkm> | ||
+ | </source> | ||
+ | |||
+ | '''Example of use:''' | ||
<source lang="csharp"> | <source lang="csharp"> | ||
// Read actual configuration | // Read actual configuration |
Revision as of 15:50, 23 September 2013
Contents |
DLL have been compiled for net 2.0 that should ensure go with any upper .net version |
OKMUtils DLL library has general purpose classes to help work with OpenKM.
Understanding the basics
- ConfigXML ( manage openkm.xml at MyDocuments/OpenKM user folder to store configuration )
- DictionaryHelper ( load .properties resource project file into dictionary )
- Logger ( manage log file into MyDocuments/OpenKM );
ConfigXML
ConfigXML helps on manage openkm.xml file stored at MyDocuments/OpenKM to keep application configuration parameters. First time is called ConfigXML if MyDocuments/OpenKM/openkm.xml configuration file not exists create one with default values.
Example openkm.xml file:
<?xml version="1.0"?>
<openkm>
<host>http://192.168.1.34:8180/OpenKM/</host>
<user>okmAdmin</user>
<password>1HpkvlY72ks=</password>
<version>2</version>
<idioma>enGB</idioma>
</openkm>
Example of use:
// Read actual configuration
ConfigXML configXML = new ConfigXML();
// Read webservice based on OpenKM version
OKMWebservice webservice = null;
if (configXML.getVersion().Equals("") || int.Parse(configXML.getVersion())== OKMWebServiceFactory.PROFESSIONAL_6_4)
{
webservice = OKMWebServiceFactory.getInstance(configXML.getHost(), configXML.getUser(), configXML.getPassword(), OKMWebServiceFactory.PROFESSIONAL_6_4);
}
else
{
webservice = OKMWebServiceFactory.getInstance(configXML.getHost(), configXML.getUser(), configXML.getPassword(), OKMWebServiceFactory.PROFESSIONAL_6_2);
}
// Here for example store new configuration
configXML.setHost("http://localhost:8080/OpenKM");
configXML.setUser("okmADmin");
configXML.setPassword("admin");
configXML.setVersion(OKMWebServiceFactory.PROFESSIONAL_6_4.toString());
configXML.setLanguage("esES");
configXML.CreateConfigurationFile();
Program.configXML.ReadConfig(); // After created configuration file is good practice read again