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.
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?
Calling an import definition manually from code
Hi all,
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,
Bo
Hi Bo,
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
ImportStatistics gives you some information about imported records.
Hope this helps,
Richard
Hi Richard,
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?
Cheers,
Laura
Works like a charm! :) Thanks a lot Richard - greatly appreciated!
is working on a reply...