Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Does anyone know if it's possible to call/trigger an import definition from a page/usercontrol using C#? :-)
Thanks a lot in advance.
All the best,
Yes this is possible. State objects are stored in the CMSImportState table of the Umbraco database. Get the guid stored in the UniqueIdentifier column for the state object you want to import. then use the following code to import the records.You need to add a reference to cmsimport.library.dll and cmsimport.extensions.dll
var importState = StateHelper.GetPersistedStateByWizardID(new Guid("41ED1164-BE12-40F0-9FA8-23F9C8180B15"));ImportStatistics stats = ImportHelper.ExecuteImport(importState);
ImportStatistics gives you some information about imported records.
Hope this helps,
I am interested in calling an import manually from code as well, unfortunately the ExecuteImport(Guid importId) method is not longer in ImportHelper class.
Is there another way to manually call an import function with the Id please?
Works like a charm! :) Thanks a lot Richard - greatly appreciated!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted