The reason for your infinite loop, is the calling of contentService.SaveAndPublishWithStatus(content).
You need to use the overload, which doesn't raise events, as your ContentServiceSaving event, will trigger your CreatePage method again, creating a new "Dummyfolder1" page. This will then raise the ContentServiceSaving event again, and further on...
IIRC, you can add false as the second parameter for SaveAndPublishWithStatus, but check with Intellisense, just to be sure.
I need to create folder when xml import by using cmsimport.
my goal is creating a folder in content menu, when xml import.
I don't know, in which event need to put the code,
but i trying below code , two method is calling continuously in loop, finally overflow exception is showed
Hi Srinivasan
Welcome to Our, the friendly community.
The reason for your infinite loop, is the calling of
contentService.SaveAndPublishWithStatus(content)
.You need to use the overload, which doesn't raise events, as your
ContentServiceSaving
event, will trigger yourCreatePage
method again, creating a new "Dummyfolder1" page. This will then raise theContentServiceSaving
event again, and further on...IIRC, you can add
false
as the second parameter forSaveAndPublishWithStatus
, but check with Intellisense, just to be sure.is working on a reply...