3

I'm developing an extension which saves some Page data (on the Save/SaveClose/SaveNew event) to the app_data table throught Core Service Client with the follow code:

Byte[] byteData = Encoding.Unicode.GetBytes(applicationData);
ApplicationData appData = new ApplicationData
{
    ApplicationId = "AppData:Page",
    Data = byteData,
    TypeId = "-64"
};
_client.SaveApplicationData(tcmElement, new[] { appData });

It works fine, but when I reload the Page the data that I get is wrong, because is data stored in a previous version of the item in the app_data table... I read the data following this code:

ApplicationData appData = _client.ReadApplicationData(tcmElement, "AppData:Page");*

Do you know what could be the problem? Is there any way to get a specific version of the data in app_data?

Thanks in advance!

6

The SaveApplicationData method saves Application Data on the (version of) the item you specify as first parameter.

Note that a TCM URI can contain a version number (-v{version} suffix). In case of a Versioned Item, a TCM URI without version implicitly addresses the latest, checked-in version. If you want to add App Data to a checked-out item (which will be checked-in later), you should use the Dynamic Version, which has a -v0 suffix in its TCM URI.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.