Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a related multilinugal site in umbraco 4.7.2 trying to delete and unpublish the documents using their relation in application base .cs file :
My code is :
var allDocId = SqlHelper.ExecuteScalar<Object>("Select nodeId from cmsDocument");
Document currDoc = new Document(sender.Id);
Relation[] relations = Relation.GetRelations(sender.Id);
//Relation[] re = sender.Relations;
foreach (var cDocId in allDocId.ToString())
{
foreach (var r in relations)
int cId = int.Parse(cDocId.ToString());
if( cId == r.Child.Id)
Document delDoc = new Document(r.Child.Id);
if (delDoc.Published)
delDoc.UnPublish();
}
delDoc.delete();
I dont know why , but related document does not get deleted. can anyone help me for this problem.
thanks in advance.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
trying to delete related Document?
I have a related multilinugal site in umbraco 4.7.2 trying to delete and unpublish the documents using their relation in application base .cs file :
My code is :
var allDocId = SqlHelper.ExecuteScalar<Object>("Select nodeId from cmsDocument");
Document currDoc = new Document(sender.Id);
Relation[] relations = Relation.GetRelations(sender.Id);
//Relation[] re = sender.Relations;
foreach (var cDocId in allDocId.ToString())
{
foreach (var r in relations)
{
int cId = int.Parse(cDocId.ToString());
if( cId == r.Child.Id)
{
Document delDoc = new Document(r.Child.Id);
if (delDoc.Published)
{
delDoc.UnPublish();
}
delDoc.delete();
}
}
}
I dont know why , but related document does not get deleted. can anyone help me for this problem.
thanks in advance.
is working on a reply...