Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > using CurrentDocument View modes: 
User avatar
Member
Member
Chanan - 3/14/2011 8:54:04 PM
   
using CurrentDocument
Hello,

I am trying to update some values in the current document. I thought I could use something like this:

CMSContext.CurrentDocument.SetIntegerValue("Column", number, true);
CMSContext.CurrentDocument.Update();


However, I get an error: [TreeProvider.CheckUser]: No user specified. You must initialize the UserInfo property of the tree provider.

My question is - wouldn't CurrentDocument take into account CurrentUser?

User avatar
Kentico Support
Kentico Support
kentico_radekm - 3/16/2011 2:22:23 AM
   
RE:using CurrentDocument
Hello.

Please note you should not update any document like this. CurrentDocument class returns TreeNode, so it allows you to call these methods (as they are implemented in TreeNode class), however main purpose of whole CMSContext class is to see context of current code and to be able to get data from, but not to change it.

If you want to update a document, you can use following API:http://devnet.kentico.com/docs/devguide/update_document.htm

Best Regards,
Radek Macalik


User avatar
Member
Member
Chanan - 3/16/2011 6:07:46 AM
   
RE:using CurrentDocument
Good to know, I don't recall seeing that mentioned in the documentation. Anyway, while I was waiting for an answer, I already did change the code to use SelectNodes but as you see in this thread: http://devnet.kentico.com/Forums/f45/t19278/Integer-column-refuses-to-update.aspx it gave me problems updating integer columns. Please take a look at the thread if you can and let me know if I am doing something wrong.

Thanks,
Chanan.