Update documents in DocumentLibrary
Hello!
I need to update some properties of a document directly from code. I try, for example, to update the property ViewsCounter. This is the code:
var linkButton = sender
as
System.Web.UI.WebControls.LinkButton;
if
(linkButton !=
null
)
string
text = ((System.Web.UI.WebControls.LinkButton)(sender)).Text;
LibrariesManager libManager = LibrariesManager.GetManager();
IQueryable<Document> documents = libManager.GetDocuments().Where(o1 => o1.ApprovalWorkflowState ==
"PUBLISHED"
);
Document doc = documents.Where(o1 => o1.Title == text).FirstOrDefault();
doc.ViewsCount++;
libManager.SaveChanges();
Hello Ilaria,
The user you use does not have permissions to modify document items. If this user is not authenticated you should use SuppressSecurityChecks property of the provider and set it to true.
Greetings,
Ivan Dimitrov
the Telerik team