1/ Im trying to copy and publish a document, but the new copy does not get published, i wonder why: User user = new User(0); Document doc = new Document(intId); doc.Copy(GetCustomerOfferNode(), user); doc.Publish(user); umbraco.library.UpdateDocumentCache(doc.Id); umbraco.library.RefreshContent(); BindGridData();
2/ When deleting documents "UpdateDocumentCache" and "RefreshContent" dosent seem to work propperly. Because when rebinding my grid from a datatable with ChildrenAsTable() my deleted document still shows in my grid... why is that?? Document doc = new Document(intId); doc.delete(); umbraco.library.UpdateDocumentCache(doc.Id); umbraco.library.RefreshContent(); BindGridData();
I found a solution to problem1: Document doc = new Document(intId); doc.Copy(GetCustomerOfferNode(), user, true); foreach (Relation r in Relation.GetRelations(doc.Id, RelationType.GetByAlias("relateDocumentOnCopy"))) { Document newDoc = new Document(r.Child.Id); newDoc.Publish(newDoc.User); umbraco.library.UpdateDocumentCache(newDoc.Id); r.Delete(); }
copy and delete documents
Hi,
1/
Im trying to copy and publish a document, but the new copy does not get published, i wonder why:
User user = new User(0);
Document doc = new Document(intId);
doc.Copy(GetCustomerOfferNode(), user);
doc.Publish(user);
umbraco.library.UpdateDocumentCache(doc.Id);
umbraco.library.RefreshContent();
BindGridData();
2/
When deleting documents "UpdateDocumentCache" and "RefreshContent" dosent seem to work propperly.
Because when rebinding my grid from a datatable with ChildrenAsTable() my deleted document still shows in my grid... why is that??
Document doc = new Document(intId);
doc.delete();
umbraco.library.UpdateDocumentCache(doc.Id);
umbraco.library.RefreshContent();
BindGridData();
I found a solution to problem1:
Document doc = new Document(intId);
doc.Copy(GetCustomerOfferNode(), user, true);
foreach (Relation r in Relation.GetRelations(doc.Id, RelationType.GetByAlias("relateDocumentOnCopy")))
{
Document newDoc = new Document(r.Child.Id);
newDoc.Publish(newDoc.User);
umbraco.library.UpdateDocumentCache(newDoc.Id);
r.Delete();
}
BindGridData();
is working on a reply...