Hello,
What VPP class have you mapped to the 'images' virtual directory. This can be found in web.config under:
<episerver xmlns="http://EPiServer.Configuration.EPiServerSection">
<virtualPath customFileSummary="~/FileSummary.config">
<providers>
<add virtualName="Images" type"............"
Thanks for the reply.
I don't think I have to do that, do I? I set the root folder on the Content Channel configuration within the EPiServer Admin. My understanding is that the parameter 'channelRelativeFilePath' is for passing the name/path of sub-folder to use (or create if it doesn't exist) for the file you are importing. This path, as the name suggests, is channel relative so if my root (set in Admin) was "~/Global/Imported/" and I pass "Images/", my file will be imported into "~/Global/Imported/Images/".
Maybe I have this wrong, I would appreciate some input.
I have tried creating the Images folder within /Global/Imported/ but the same exception comes up when I run the import.
It seems you cannot pass an empty string either. You get a different exception - EPiServer.Core.EPiServerException: channelRelativeFilePath must be given.
Oh, and I am using EPiServer 6.0.
Hi again James.
Unfortunately I am told you will need to register a support case here:
http://world.episerver.com/Support/Register-Support-Incident/
Regards
Paul
Right, that's it sent.
I selected that it's a CMS 6.0 issue but my case is listed within an inbox named CMS 5 under my EPiDesk account. Strange.
Thanks again, Paul.
Cheers,
James
Hi James,
The RelativePath parameter must include file name,
so channelService.ImportFile(ImporterSettings.ContentChannelName, rawData, false, "images/");
should be channelService.ImportFile(ImporterSettings.ContentChannelName, rawData, false, "images/filename");
I'm getting an exception when trying to import a page using content channels.
My code, which is really straight-forward:
DirectoryInfo dirInfo = new DirectoryInfo(myLocalPath + myImagesFolder);
foreach (FileInfo file in dirInfo.GetFiles())
{
EPiServer.Content.ContentChannelService channelService = new EPiServer.Content.ContentChannelService();
byte[] rawData = File.ReadAllBytes(file.FullName);
channelService.ImportFile(ImporterSettings.ContentChannelName, rawData, false, "images/");
}
Has anyone had any experience with this? I've pasted the exception details below if it's of any relevance.
Thanks,
James
-------------------------------------------------------------------------
The exception details:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentNullException: Value cannot be null.Parameter name: virtualPath at System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) at System.Web.VirtualPathUtility.Combine(String basePath, String relativePath) at EPiServer.ContentChannels.ContentChannelHandler.CreateFile(String channelId, UnifiedDirectory directory, String fileName, Guid fileId, Byte[] data, Boolean expectMoreData, IDictionary`2 metadata) at EPiServer.ContentChannels.ContentChannelHandler.ImportFile(String channelId, Byte[] data, Boolean expectMoreData, Guid fileId, String channelRelativeFilePath, IDictionary`2 metadata) at EPiServer.WebServices.ContentChannelService.ImportFile(String channelId, Byte[] data, Boolean expectMoreData, Guid fileId, String channelRelativeFilePath, String[] metadataKeys, String[] metadataValues) --- End of inner exception stack trace ---
-------------------------------------------------------------------------