I'm trying to set the unpublish date to a node programmatically but im hitting an issue.
Here is the code i have and im not sure why its not working:
var c = Services.ContentService.GetById(1214);
c.SetValue("_umb_expiredate", DateTime.Now.AddMonths(1));
Services.ContentService.SaveAndPublishWithStatus(c);
I'm getting the error of No PropertyType exists with the supplied alias: _umb_expiredate but this property does exist but its a default umbraco one...
Programmatically set unpublish date
Hi all,
I'm trying to set the unpublish date to a node programmatically but im hitting an issue.
Here is the code i have and im not sure why its not working:
I'm getting the error of
No PropertyType exists with the supplied alias: _umb_expiredate
but this property does exist but its a default umbraco one...Anyone know where im going wrong?
Thanks, Lewis
Hi Lewis,
IContent
has anExpireDate
property with the following description:So given your code example, it ought to be something like this:
Hope that helps ;)
Hi Anders,
That looks good! I will give that a go tomorrow morning when i get back into the office!
I will let you know how i get on!
Thanks, Lewis
is working on a reply...