Hot answers tagged

25

You just need to Load component with proper LoadFlags, like this: Component component = (Component)engine.GetObject(package.GetByName(Package.ComponentName)); component.Load(LoadFlags.KeywordXlinks); output = package.CreateXmlDocumentItem( ContentType.Xml,component.ToXml(XmlFormat.R6Native, XmlSections.All).OwnerDocument); It will look like this: <...


17

Coming from a mixed content delivery (ASP.NET) and business analyst background, I've been interested in the same type of resources. I've typically followed the Tridion community, asked questions, and shared what I've learned. Here are some posts I've shared along with my favorite public sources that explain approaches and include much appreciated context ...


16

Session.IsExistingObject Method will not throw exception


14

You can get the schema.Purpose which gives you an enum (SchemaPurpose) this gives you access to all the schema types including: Component Multimedia Embedded Metadata Protocol TemplateParameters UnknownByClient VirtualFolderType


13

Basically a DWT Template allows you to iterate over arrays, but in the Package there is only one sort of array we can push ourselves, which is the Component Presentation array (which can contain Component Template TCMURIs, but also only Component TCMURIs). Through this you can push (what I refer to as) a Dummy Component Array in the package which you can ...


12

You could check to see if the ItemField type is a XhtmlField. if (itemField is XHtmlField) { // Is Rich Text Field } else if (itemField is TextField) { // Is Text Field } else { ... }


12

The Tridion practice project is explicitly aimed at gathering together good examples of different areas of Tridion practice. In the cookbook section, there's an entire "chapter" about compound templating. Maybe this can become an even better resource if more people are aware of it and help with their own contributions. (It's Free... under an MIT license.) ...


11

This is indeed achievable. The following example should clear things up. You can use ComponentMetaFactory (passing in the publication ID), and then use it to retrieve the metadata for the component (passing in the Items ID). This can be used to gather all sorts of information about the components metadata such as creation dates, custom metadata, initial ...


11

If a component is linked as a parameter you never get the item as a component object, using Package.GetValue("name in schema") will return the string ID of the component. From there you can use the engine.GetObject(tcmid) to get the object. Hope this helps xxx


9

I am going to make my answer a little broader than DWTs/c# TBBs and instead address the wider availability of study materials for Tridion 2011. As Nuno mentioned, there are not any books like the Wrox Professional series of books on .net for SDL Tridion. However, in addition to the documentation on SDL Live Content Nunos has linked to in his answer, there ...


9

Well... if Tridion had the resources (and following) of Microsoft, I'm sure you would have such books. Since Tridion/SDL doesn't have those resources, we have to be creative and (maybe) write one ourselves. The best start is probably to go through the CHMs (available for download here - login required), not everything is fully documented but it is improving ...


9

The TOM.NET API in 2009 was read-only, so your only option is the TOM API, and for .NET code, you can use the TOM Interop DLLs. You will need to reference Tridion.ContentManager.Interop.cm_tom.dll and Tridion.ContentManager.Interop.cm_defines.dll (found in the [Tridion]\bin\client\PIA folder on your CMS) Then you can use the TOM API in your .NET code (...


8

By using method IsPublished of class PublishEngine with parameters Page and PublicationTarget, you can find the publish status public void Transform(Engine engine, Package package) { Item pageItem = package.GetByType(ContentType.Page); Page page = engine.GetObject(pageItem.GetAsSource().GetValue("ID")) as Page; PublicationTarget pubTarget = new ...


8

Welcome to the Tridion Stack Exchange. Can you let us know which version of Tridion you are using please? If you are using Tridion 2011, then I think that this has already been answered (by Bart) in Rob's "Tridion 2009 TBB: How do I determine if a Page is published to particular publication target?" question over on Stack Overflow here. The ...


8

If the main purpose of this code is just delete keywords that are not used, you can just try to delete each keyword one by one. If the keyword is in use, the api just won't allow you to delete if the keyword is used for classify, is used in metadata, is localized, etc... You can capture the exception and continue with the next one. I recommend to do a ...


7

It seems like deleting and org item should trigger delete events for all contained items. As such you should not need to iterate through the child items as you can log on all the delete events individually. Have you tried that?


7

It is in ComponentTemplate.IsRepositoryPublishable. Once you know the name it makes sense. From the API doc: public bool IsRepositoryPublishable { get; set; } A "dynamic" Component Presentation is published separately instead of being embedded on a Page. The checkbox Allow on Page Using Dynamic Assembly is in ComponentTemplate.AllowOnPage, that ...


7

Let's take an example to illustrate these concepts: suppose the user publishes a Structure Group which contains a Page which, in turn, contains an embedded Component Presentation and a Dynamic Component Presentation. This results in a single Publish Transaction for the given Structure Group. The first thing the Publisher does with a Publish Transaction is ...


7

engine.GetSession().User returns the User for which the Session was created. So it definitely will not solve the issue. I guess PublishEngine.GetPublishInfo(item) excludes the current publish because the current publish operation is still not finished. But I guess publish transaction can help you getting the user title. You can try getting the publish ...


7

It's gonna be something like this: var filter = new ClassifiedItemsFilter(); filter.ItemTypes = new[] { ItemType.Component }; filter.BasedOnSchemas = new[] { schema }; var components = keyword.GetClassifiedItems(filter); In TOM.NET you have no control over queries, all the actions are executed just in time, but this code should go to database only once (...


7

There are two things you can do. First If it is sufficient or preferable for you to get AddedItems during complete event They are available but not loaded. Use ITranslationJob.LoadState property to see what data loaded in translation job And then if AddedItems is not loaded Use ITranslationJob.LoadDetails (TranslationJobLoadFilters.AddedItems) to ...


6

There's no way to do it. Functionality you are looking for was added in SDL Tridion 2013 release. There you can push page into any existing process, or start a new one, without even specifying anything on structure group


6

Err.Raise is the VBScript equivalent to 'throw new Exception'. In a .Net C# Template (or Razor template) you would do something like: throw new Exception("This page should be published only to mobile site");


6

Verify that you have xmogrt.dll in the bin, is the right version for your CPU (x64) and is not corrupt (perhaps a bad copy/paste from one VM to another?). The proper version should have the size: 1.59 MB (1,668,608 bytes). Here is a post offering more details about common issues related to Juggernet (xmogrt.dll) http://www.tridiondeveloper.com/tridion-...


6

You don't need to read the item in this case, you can just use the Subject property: TcmUri workItemUri = new TcmUri(workItemId); WorkItem workItem = new WorkItem(workItemUri, new Session()); Component component = (Component) workItem.Subject; The Component will be read just in time (JIT) as soon as you access some of its properties.


6

Mihai Cădariu explains we should use the non-obsolete methods under: Tridion.ContentManager.Publishing.Rendering.RenderedItem Tridion.ContentManager.Templating.Engine (avoid TemplatingRenderer.AddBinary) The additional String in most of the method signatures lets you add a Variant ID to publish variations to different places. The string is saved in ...


6

As you noticed, you can add binaries on the fly with AddBinary, however they always need to be variants of a component (although not necessarily a multimedia component). The reason for this relationship is to ensure that the ad hoc binaries are managed ie, they can also be unpublished (when the related component is unpublished). The simplest way to manage ...


6

GetItems() returns an IEnumerable<RepositoryLocalObject> which can potentially contain Pages and Structure Groups. Adding the optional Filter parameter will limit the types of items returned. Item Types can be filtered based on the below rules: If the container is a Publication: ItemType.Folder (returns the root Folder) ItemType.StructureGroup (...


6

It all depends to what event you actually subscribed, there are three parameters when you subscribe to an event, the subject type, event type and the phase. In your situation, the event type is crucial. When you use the Tridion.ContentManager.Extensibility.Events.PublishOrUnPublishEventArgs, you will subscribe to both the Publish and UnPublish actions, ...


6

You can safely use Tridion.Common.dll in your CoreService apps, this dll has no dependencies on the rest of Tridion and contains (among others) the TcmUri class.


Only top voted, non community-wiki answers of a minimum length are eligible