The documentation is not clear on it, anyways I use the following code:
So I ended up adding the item in both scopes, when directly punblished. Is this Correct?
Also when an Item IsPublished, How do I remove it again. Delete in unpublished scope works fine. But deleting the same item in published scope (just like I do with insert) gives an error about a non existing dataSourceIds.
using (DataConnection conn = new DataConnection(PublicationScope.Unpublished))
{
var item = conn.CreateNew<Custom.DataFolder>();
item.Id = Guid.NewGuid();
item.PageId = CurrentPageNode.Id;
item.PublicationStatus = "published";
//other props
conn.Add<Custom.DataFolder>(item);
}
I expect the new item to be added and published. But for some reason this doesn't fill the " "_Published.xml" of my datatype. So I ended up adding the item in both scopes, when directly punblished. Is this Correct?
Also when an Item IsPublished, How do I remove it again. Delete in unpublished scope works fine. But deleting the same item in published scope (just like I do with insert) gives an error about a non existing dataSourceIds.