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

Try our conversational search powered by Generative AI!

Sitecore to Episerver Migration

Vote:
 

While migrating from Sitecore to Episerver. I am convert Sitecore items into JSON and I have written a code in Episerver to import the JSON.

The Sitecore item content is converted into JSON but there are some image fields in the item and how can I migrate image field into Episerver ?

One solution is to download the media item from Sitecore locally and add a downloaded image path reference into JSON. Here is the JSON example

  {
        "Path":  "/sitecore/content/LLCom/Shared/In the news/2016/03/09/22/14/Titans Host Soldiers and Families for Salute to Service Movie Screening at LP Field",
        "Name":  "Titans Host Soldiers and Families for Salute to Service Movie Screening at LP Field",
        "Version":  {
                        "Version":  "1",
                        "Language":  "en",
                        "Abstract":  "abstract description",
                        "Date Created":  "20150523T140000Z",
                        "Region":  "America",
                        "Title":  "Title",
                        "Image":  "C:\mediafiles\abc.jpg"

                    }
    },

When importing the JSON into Episerver, the code will look for the Image path and will upload it into Episerver.

Is this a correct way of doing it or are there any better solutions?

Any advice would be appreaciated.

Thanks 

#259618
Jul 29, 2021 2:20
Vote:
 

I would export every file locally first. Then I would first try to import them to Episerver with the same relative URL if possible. Since you can set the URL segment on a new content item in Episerver it might be possible. If it works you don't need to worry about breaking any links to images which is really nice.

If not possible for some reason I would import them to Episerver in some other structure but store an external identifier on the content in Episerver that contains the id of it in Sitecore as well as the old relative Url in a separate property. Then I would rewrite any links in texts etc. Probably best to do that in the json format before importing.

#259635
Jul 29, 2021 16:08
Vote:
 

I'd solve this in different ways depending on the pure volumn of image content.  Since you've already written an import routine to process the content, you could extend it to also download and save the images directly into the CMS. 

There is a nice easy start article that you could look at here: https://marisks.net/2017/07/13/programmatically-upload-image-to-episerver/ but you'd need to extend it into also creating and navigating the media asset folders to maintain the same image folder structure.  When you call contentRepository.GetDefault<T>(SiteDefinition.Current.GlobalAssetsRoot), you can replace SiteDefinition.Current.GlobalAssetsRoot with the content reference for the folder you want the image to be accessible in.

#259975
Aug 03, 2021 8:27
Vote:
 

Thanks Stotty and Daniel. Is there a way we can upload video programatically?

#260035
Aug 04, 2021 5:02
Vote:
 

Theoretically It should be no different to uploading an image, but there is a ~2GB limit on the MemoryStream object due to the use of int32 for indexing.  So you'll need to consider the size of your largest media asset.  If the video's are too large, then you may need to manually upload them, at which point you'll need to override the maximum request length in your web.config for the EPiServer path:

<location path="EPiServer">
	<system.web>
		<httpRuntime maxRequestLength="1000000" requestValidationMode="2.0" />
	</system.web>
	<security>
		<requestFiltering>
			<!-- IIS settings, specifies the maximum length of content in a request in bytes, default value is 30000000 -->
			<requestLimits maxAllowedContentLength="1024000000" />
		</requestFiltering>
	</security>
</location>
#260040
Aug 04, 2021 8:27
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.