The only obvious problem is that you should subscribe to EventPhases.Initiated instead of EventPhases.TransactionCommitted. Other than that it looks fine, unless you are calling component.Save somewhere down the line.
The event system code loads when the Tridion Content Manager Service Host service loads, and you can see this in the Windows Event Viewer. As each event handler loads you will see the status showing that the TCM Extension has been initialized.
In the UnPublishEventArgs there is a member UnPublishInstruction.
This will have a property - StartAt - If StartAt property is set to DateTime.MinValue that means the Unpublishing is scheduled for Immediate unpublish and if it is set to a particular datetime, that means it is schedule to unpublish at some other time.
Unless you're trying to implement really granular permissions (more on that in a minute) it makes more sense to handle this on the check-out event instead. The rudimentary issue that I see - and this also applies to implementing granular permissions (e.g., treating check-in and check-out as two separate permissions) - is that by the time the check-in event ...
What have you tried? If you're just starting your search then the docs references below are a great start.
Both the TOM.NET and Core Service APIs are available but it shouldn't be about what's easiest. It would be interesting to understand if there some technical or business reason you want to consider using the Event System?
If you have Alchemy installed,...
I may just not be seeing it in the code, but you're not implementing IDisposable and there's nothing in your code calling Dispose(). If you're not disposing of the subscription it never actually finishes executing, as Dispose is what enables garbage collection to clean up all of your references. Have your class implement IDisposable.
Since way back I have been working with a batch file (which calls a script for COM+ shutdown) called from a post build event in Visual Studio to deploy to my development environment (note this only really works if run on the server itself - but I typically develop event system code on the server, in order to debug it). As it works fine, I never made an ...
It sounds like you are hooking into the Processed (or later) phase of the Save operation, which will only be called after the save has happened.
You should instead hook into the Initiated phase of the save. This one occurs before the save and so giving the field a value will satisfy the mandatory requirement of the field when the save does occur.
For #1 publishing priority is the way to go. Maybe changing the default priority to "low" will give you enough of an override to push things through quickly. Using publishing priorities in conjunction with the information I share in the blog post on keeping threads available.
Item #2 might need event system, but you should be careful of performance impacts. ...
You can try the below events related to Workflow:
1.Event for Workflow process starts
EventSystem.Subscribe<ProcessInstance, StartWorkflowEventArgs>(OnProcessInstanceStart, EventPhases.Initiated);
2.Event for Workflow activity starts
EventSystem.Subscribe<ActivityInstance, StartActivityEventArgs>(OnActivityInstanceStart, EventPhases....
You would have to make CSS updates through a GUI extension besides using the new line (\n) in your exception message.
In your event system exception, you will be using the new line like this:
throw new Exception("Some text before new line.\nSome text after new line.");
In the GUI extension, set the CSS white-space property to pre-wrap in the div element of ...
My guess would be that when you are creating a new page based on page type in XPM, XPM is actually cloning/copy and paste the type and then updating it with the appropriate values. Recommend subscribing to CopyEventArgs to confirm.
Creating a new page in XPM using a Page Type should fire CopyEventArgs, however, copy operation is done on system, and ...
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 ...
You see event viewer message that your extension was initialized, so no problem here. However, it might be the case that you (NETWORK SERVICE) don't have rights to write to event log, or your code is just wrong. I would suggest trying something simpler, like creating a file on the hard drive, or just throwing exception. This way you will at least know that ...
You could consider [[removed:OOTB]] Supported category use with the Tree View. The user would select from the top-down and the field populated with the final select.
Of course, by supported I mean without having to provide a custom extension - to add them is a content job; you could initially do this as a manual process and then automate the creation/...
Another option is to temporarily elevate permissions of the current user in the event handler:
using (ElevatedPrivilegesScope scope = new ElevatedPrivilegesScope(nonAdminSession, Privileges.SysAdmin))
// Do your admin tasks
In this case, the component will be created on behalf of the current user (even if that user does not have privileges to do so ...
Legacy events are backwards compatible in Tridion 2011.
Check if you class is using this Prog Id "TDSEvents.Events"
Is your class COM visible?, you can check it in the AssemblyInfo class
Does your assembly have an strong name?
As Nuno always recommends, after you have checked all the steps above, create a single vbs file and try to create an object for ...
The commonest cause of failing to deploy a new events dll is that an existing process is holding a lock on the dll in the file system.
In development, you probably don't care about restarting Tridion, but as you say, it can be tedious. I usually use a script for it. You can see an example on this blog entry. Check out the RestartAllTridion function in ...
If you are using the Event System Handlers introduced in Tridion 2011, then you can easily pass information of any type between event handlers by using ContextVariables, which are loaded in the EventArgs of the event currently being triggered. The example below shows how to do that:
public class ...
I see your point, there is an old PS implementation called Metadata Processor that performs the following logic.
At publishing time there an special syntax written at the beginning of the template that writes the Output variable, that special syntax will instruct which design fields should be considered metadata.
At deployment time a Deployer Processor (...
This issue is probably related with the MSDTC settings.
Verify that Distribute Transaction Coordinator Service is running on the server
Go to Administrative Tools > Services
Turn on the "Distribute Transaction Coordinator" Service if it is not running
If it is running then:
Go to Administrative Tools > Component Services
On the left navigation tree, go ...
It may help for us to know more about the operations that you need to perform when publishing.
Here are a few guidelines though...
A Deployer Extension only has access to items that are stored within the Transport Package. Therefore, if your operation needs to access content that is not stored within this (e.g. user information, version history, etc.) then ...
To get the user who published, you need to use
Here Creator returns the User Object.
private void OnPagePublishPre(Page page, PublishEventArgs mPublishEventArgs, EventPhases phase)
List<PublishTransaction> mPublishTransactionList = mPublishEventArgs.PublishTransactions.ToList();
foreach (PublishTransaction ...
Here just for your reference I pasted a code to get the user and also Groupname if you publish any component.
private void PublishingFinish(Component subject, PublishEventArgs e, EventPhases phase)
User user = subject.Session.User;
foreach (GroupMembership group in user.GroupMemberships)
Perhaps you can do this through a GUI extension - and thus better inform a user that a value was entered. I presume you're aware that fields can have 'default' values already - which may negate your code even running in many instances?
The best way to approach this (event system, GUI extensions, user process/education) will likely depend on the specifics of ...
So you set the title after making sure your Component is checked out, but you tried to sync back the changes of the content before ensuring it is checked out:
// sync content back to Component
newComp.Content = content.ToXml();
// sync metadata back to Component
newComp.Metadata = embeddedFields.ToXml();
Bart already pointed out the proper order to do this check-out/modify/check-in cycle after the copy operation is performed.
Do note that this approach leads to a version 2 on the copy: version 1 is the unmodified copy and your post-processing creates a version 2.
This may be exactly what you want, but note that it is also possible to modify the copy without ...