November Happy Hour will be moved to Thursday December 5th.

Bulk update the cms content meta details by reading .csv file from scheduled job

Vote:
 

Hello,

We are trying to update CMS content item meta details by reading .csv file containing details of pages with friendly url and meta information. We are adding it as a scheduled job to update content items to respective content item with Url's.

But we can't use UrlHelpers to match the friendlyurl with content item as it gives activation error for UrlHelper key being empty. 

Is it possible to do it via scheduled job this way or there is any other approach which is more preferred than this?

Thanks,

Deepa

#290164
Oct 17, 2022 16:11
Vote:
 

You could try using the IURLResolver 

e.g. 

public IContent GetContent(string url)
{
    var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
    IContent contentData = urlResolver.Route(new UrlBuilder(url));

    return contentData;
}
#290165
Oct 17, 2022 17:19
Deepa Puranik - Oct 18, 2022 11:54
Thank you for quick help.
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.