I've got some code which I've realised isn't working correctly.
It was supposed to get me all content of a particular document type, but it doesn't get everything.
Excuse the vb.net code but any help is appreciated.
I'm on v7.5.13, importing pages from an older CMS, and yes, the missing pages have been correctly assigned the doctype I'm looking for.
Note that I've switched off the XML cache due to the size of my site.
Dim cs As IContentService = ApplicationContext.Current.Services.ContentService
Dim cts As IContentTypeService = ApplicationContext.Current.Services.ContentTypeService
Dim dt As Integer = cts.GetContentType("myDocType").Id
Dim d As IEnumerable(Of IContent)
d = cs.GetContentOfContentType(dt)
Try
For Each doc As IContent In d
'some processing takes place here
'with the doc.Id etc, i.e. I'm adding the Id to a hashtable
...
Next
Catch ex As Exception
'exception handling
End Try
ContentTypeService GetContentOfContentType
Dear all
I've got some code which I've realised isn't working correctly.
It was supposed to get me all content of a particular document type, but it doesn't get everything.
Excuse the vb.net code but any help is appreciated.
I'm on v7.5.13, importing pages from an older CMS, and yes, the missing pages have been correctly assigned the doctype I'm looking for.
Note that I've switched off the XML cache due to the size of my site.
Apologies, I'm being an idiot (again).
The
For Each
loop that built the hash table was bombing out on duplicates, something I had fixed but managed to unfix.Thanks
Muiris
EDIT: ... and the
Try Catch
should have been inside the loop, at the point where the hash table was being added to.is working on a reply...