Hot answers tagged

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


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


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 ...


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

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 ...


8

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 ...


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 (...


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

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

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.


6

You can get the bytes of the document/image/... that was uploaded to the multimedia component. I believe you can get it using this code // MMComp contains the multimedia component - you can get this via a call to the GetObject(tcmuri) function if (MMComp.BinaryContent != null) { var bytes = MMComp.BinaryContent.GetByteArray(); } Now, you have the ...


6

The Razor Mediator has excellent documentation, including the info you're looking for: https://code.google.com/p/razor-mediator-4-tridion/downloads/detail?name=RazorMediatorDocumentation_v1.3.3.docx In your case I think you'll want to use the @Publication.PublicationUrl to get the URL then concatenate the @Page.FileName onto the end of it.


6

@Marlowe, glad to hear that you like XView :) I've created this quick video to show how you can use XView in combination with RazorEngine to develop Tridion TOM.NET templates with ViewModels, Razor views, Builders (for building ViewModels) and Unit Testing the Razor views without depending on Tridion. Video: https://www.youtube.com/watch?v=_6_jP7cVT_8 ...


6

Let me try to understand what you need to achieve. According to TOM.NET API documentation, GetListMultimediaTypes is used to retrieve all multimedia types defined in system (.jpg, .png, .doc....) So, I guess you want to retrieve same data using Core Service. You can get this data by using MultimediaTypesFilterData MultimediaTypesFilterData filter = ...


6

Instantiating Session object in the constructor of ES doesn't work from version 8 and beyond. We had this issue when we did the upgrade from 2013 to 8.5. So what we did is moved it to all event subscriptions methods. Please use it like that and forget about using Core Service in event system because it is an abomination, a Frankenstein which shouldn't exist ...


5

Actually you can use Filter and PublishTransactionsFilter as mentioned below: Filter filter = new Filter(); filter.Conditions["ItemType"] = ItemType.Component; PublishTransactionsFilter publishTransactionsFilter = PublishTransactionsFilter(filter, session); publishTransactionsFilter.StartDate = startDate; publishTransactionsFilter.EndDate = endDate; ...


5

I'm not sure the "field builder" approach was available before SDL Tridion 2011. Consider adding an option to select items by copying an example from PowerTools, otherwise a Custom URL or GUI Extension are other ways to change the component editing form itself. Selection in a 2009 Extension The R5.2/5.3/2009 PowerTools has examples for selecting items. For ...


5

Is there something in the SDL Tridion RTF field that you don't like, or do you have an external application that you are using to update the components? It's possible to extend the CKE with your own functionality (see here). I suspect it wouldn't be too difficult to integrate the Item selector power tool (From the SDL World site) into the CKE. Update: I ...


5

the reason this wont save is because the namespace is missing from the richtext node, if you open the source of a component you`ll see that the component is in a namespace, meaning that anything within the richtext will need the correct namespace in order to save, below is a working example of creating a component with richtext html also uses the fields ...


5

You'll have to load the component as XML, and update/read as XML too. ItemFields will always try to load some of the properties of the linked component when it is initialized, and that means it will fail (as you have noticed already). tcccp:unresolved means that for some reason the target of that link was not found (or failed to import if it was part of the ...


5

It would definitely help if you just read the API documentation, but here is some sample code that should give you an idea: [TcmExtension("ExampleEventHandlerExtension")] public class EventHandler : TcmExtension { public EventHandler() { EventSystem.Subscribe<Component, SaveEventArgs>(ComponentSaveAction, EventPhases.Processed); } public ...


5

There's a couple of ways (as usual) to get this done. The easiest (in my opinion) is to use a custom resolver (see google results) and look inside the list of ResolvedItems - this list will contain all the items that have been resolved to be (un)published and you can manipulate the contents of the list to add or remove items from it. Another option is to ...


5

You're almost there. To determine all pages that use a given component, I would use the following code: UsingItemsFilterData pagesFilter = new UsingItemsFilterData(); pagesFilter.ItemTypes = new [] {ItemType.Page}; return client.GetListXml(componentId, pagesFilter);


5

You can use BluePrintChainFilterData Here's an example: BluePrintChainFilterData filter = new BluePrintChainFilterData(); filter.Direction = BluePrintChainDirection.Down; var result = ClientAdmin.GetListXml({THE_ID_OF_YOUR_ITEM}, filter); This will return you XML containing all the data of your children elements. There's different properties ...


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