Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Problem updating content expiry date using Content.asmx web service

Vote:
 

Hi,

I am new to Ektron development and would appreciate any help with a problem updating the ExpireDate property of content using the ContentSoapClient (exposed in the Content.asmx web service  accessed as a service reference from a WCF client). The edit method works fine for the Title and HTML properties and I can see these values being updated in the Ektron Content table. The last_edit_date field is also updated. However the end_date field is set to NULL rather than the value in the ExpireDate property. I've considered whether there is a problem with the format of the value being assigned to the ExpireDate property but the datetime value is handled in an identical fashion by AddContent4 method with which there no problem.

The following code snippet may give a clue as to what I'm missing here. BTW We are using Ektron version 9.

Many thanks

EktronContent.ContentSoapClient cxClient = new EktronContent.ContentSoapClient();
EktronContent.RequestInfoParameters cxReqParams = new EktronContent.RequestInfoParameters();

cxReqParams.ContentLanguage = contentLanguage;

blnRetVal = cxClient.CheckOutContent(GetContentAuthHeader(), cxReqParams, lngContentId);

ContentEditData ContentToUpdate = new ContentEditData();

ContentToUpdate = cxClient.GetContentForEditing(GetContentAuthHeader(), cxReqParams, lngContentId);

if (ContentToUpdate != null)
{
  if (dtEndDate.HasValue)
  {  
   ContentToUpdate.ExpireDate = (DateTime)dtEndDate;   
  }
  else
  {
   ContentToUpdate.ExpireDate = DateTime.MinValue;
  }

 ContentToUpdate.Title = strTitle;
 ContentToUpdate.Html = strXML;
     
 blnRetVal = cxClient.SaveContent(GetContentAuthHeader(), cxReqParams, ContentToUpdate);

 blnRetVal = cxClient.PublishContent(GetContentAuthHeader(),
       cxReqParams,
       lngContentId,
       (long)folderID,
       contentLanguage,
       null,
       10007,
       null);

#176727
Mar 24, 2017 9:27
Vote:
 

Try setting the EndDate & EndDateActionType instead of ExpireDate.

#176834
Mar 28, 2017 21:13
Vote:
 

Hi,

Thank you for your reply. I can see a field named enddate in the Content database table in Ektron but not on the ContentEditData class. I've been using ExpiryDate assuming that this would update the enddate field and also tried setting the EndDateActionType property to EktronContent.CMSEndDateAction.Archive_Expire without success. Please could you point me in the right direction for this propety since I can't see it anywhere on the ContentEditData class.

Many thanks

#176888
Mar 29, 2017 10:29
Vote:
 

Interesting :)

What is the value of dtEndDate? Can you use DateTime.Now instead just as a test? Maybe casting to DateTime is an issue?

Have you tried using Framework API?

            long contentID = long.Parse(id);
            // if access mode not set to admin, this error occurs:
            // "the current user does not have permission to carry out this request" - even if they really do.
            Ektron.Cms.Framework.Content.ContentManager cMgr = new Ektron.Cms.Framework.Content.ContentManager(Ektron.Cms.Framework.ApiAccessMode.Admin);
            Ektron.Cms.ContentData cData = cMgr.GetItem(contentID);

            if (cData != null && cData.Id > 0)
            {
                cData.Title = txtTitle.Text;
                cData.Html = txtInfo.Content;
                cData.GoLiveDate = schstart;
                cData.ExpireDate = schend;
                cData.UserId = cMgr.UserId;
                cMgr.Update(cData);
            }
            else
            {
                // fail
                throw new Exception("Unable to update content using the framework and info provided.");
            }

If this doesn't work, then you will have to call Epi support.

#176917
Mar 29, 2017 18:06
Vote:
 

Many thanks for your help on this. I've not been able to resolve the issue so, as you suggest, I'll get  in touch with Epi support.

Regards

#177215
Apr 05, 2017 14:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.