<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
it seems u've not locked the resource<br>
<br>
try this:<br>
<br>
<pre wrap=""><%
org.opencms.file.CmsObject ocms =
org.opencms.main.OpenCms.initCmsObject("Guest");

ocms.loginUser("Admin2", "Admin2"); // an existing user of group
Administrators

org.opencms.file.CmsProperty rProp = new
org.opencms.file.CmsProperty("ResourceProp", null, "Resource property
value", true);

<b>ocms.lock("/sites/default/index.jsp");</b>
ocms.writePropertyObject("/sites/default/index.jsp", rProp); // an existing
<b>ocms.unlock("/sites/default/index.jsp");</b>
%>
</pre>
<br>
regards<br>
<br>
manolo fdez escribió:
<blockquote cite="mid3946841.post@talk.nabble.com" type="cite">
  <pre wrap="">
Let'S talk about code:

Trying to change file properties I made the following attempt:

<%
org.opencms.file.CmsObject ocms =
org.opencms.main.OpenCms.initCmsObject("Guest");

ocms.loginUser("Admin2", "Admin2"); // an existing user of group
Administrators

org.opencms.file.CmsProperty rProp = new
org.opencms.file.CmsProperty("ResourceProp", null, "Resource property
value", true);

ocms.writePropertyObject("/sites/default/index.jsp", rProp); // an existing
file
%>

I receive an exception:
Error writing property "ResourceProp" on resource
"/sites/default/index.jsp".

Could you tell me what I'm doing wrong?

--
View this message in context: <a class="moz-txt-link-freetext" href="http://www.nabble.com/Add-Templates-to-opencms-t1391802.html#a3946841">http://www.nabble.com/Add-Templates-to-opencms-t1391802.html#a3946841</a>
Sent from the OpenCMS - Dev forum at Nabble.com.


_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
<a class="moz-txt-link-freetext" href="http://lists.opencms.org/mailman/listinfo/opencms-dev">http://lists.opencms.org/mailman/listinfo/opencms-dev</a>

  </pre>
</blockquote>
</body>
</html>