This is more of a ‘note to self’ as I’m constantly being caught out when getting an object from Tridion using the various TDSE methods.
I’ll use the example of getting a folder via the TDSE object. To do this you have two ways:
- The TDSE.GetFolder(“ID”, Publication Object) Method
- The TDSE.GetObject(“ID”, OpenMode, Publication, ReadFilter) Method
The GetFolder will always need a valid Publication object, where as the GetObject will allow a null to be thrown in.
I’ve done this a thousand times:
- TDSE.GetFolder(“tcm:1-123-2”, null);
Then spent about 20 minutes checking the XML, the webdav etc etc.
The benefit of being able to pass the null, is that if the Publication object doesn’t exist, you don’t have to create it surely making the GetObject a far superior method to use… just remember to cast to the correct Tridion item type:
- Folder fld = tdse.GetObject(…) as Folder
Please tell me I’m not alone in being constantly caught out by this!