This sample covers how to retrieve, add, and remove blog subscriptions using the API.
long blogid = 30; private string RemoveSubscription(HttpContext context) { try { Ektron.Cms.ContentAPI _contentAPI = new Ektron.Cms.ContentAPI(); _contentAPI.AddWatch(blogid, Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Blog, _contentAPI.UserId, -1, Ektron.Cms.Common.EkEnumeration.NotificationType.Never); return "false"; } catch { return "true"; } } private string GetSubscription(HttpContext context) { try { Ektron.Cms.ContentAPI _contentAPI = new Ektron.Cms.ContentAPI(); var wType = _contentAPI.GetWatch(blogid, Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Blog, _contentAPI.UserId, -1); return wType.DoesExist.ToString().ToLower(); } catch { return "false"; } } private string AddSubscription(HttpContext context) { try { Ektron.Cms.ContentAPI _contentAPI = new Ektron.Cms.ContentAPI(); _contentAPI.AddWatch(blogid, Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Blog, _contentAPI.UserId, -1, Ektron.Cms.Common.EkEnumeration.NotificationType.All); return "true"; } catch { return "false"; } }
Please sign in to leave a comment.