Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been playing with a script to get the Application Data on all publications - at the moment I just want to write it out to see what's in there.

I've confirmed several publications have tm: (Translation Manager) App Data but only get null of the Application Data below:

$pubsList = Get-TridionPublications | Select-Object Title, Id, ExtensionData;
$pubsTotal = "Total of " + $myPubs.Count + " Publications";
Write-Output $pubsTotal;
for ($i=0; $i -lt $pubsList.length; $i++) {
    [string]$title = $pubsList[$i].Title;

    if($title.StartsWith("030")){

        $pub = $pubsList[$i];

        $pub.Title;

        $appData = $core.ReadAllApplicationData($pub.Id);

        if ($appData -ne $null) {

            $appData

        }
        else {
            Write-Output "No AppData";
        }
    }
}
share|improve this question
1  
Have you looked at the appdata companion? sdltridionworld.com/community/2011_extensions/appdata.aspx or are you just honing your PowerShell skillz? – Nuno Linhares Mar 10 at 18:39
1  
I had seen this Nuno - my client is very specific about putting the minimum into their environment and I need to walk them through each line. So it's a chance to beef up on the beast that is PowerShell and ensure I can articulate every step of the way to the client :) – Dylan .. Mark Saunders Mar 10 at 18:42
    
    
Just a note that I've been adding support for Application Data on a feature brand of the Tridion PowerShell Modules. Feel free to have a look at that one (it will get merged to 'master' sometime soon): github.com/pkjaer/tridion-powershell-modules/tree/alchemy – Peter Kjaer Mar 11 at 16:22

On closer investigation of the Publication Object - this exposes the App Data as the ExtensionData as follows:

$pubsList = Get-TridionPublications | Select-Object Title, Id, ExtensionData;

This gives me the Application Data as System Object.

share|improve this answer
1  
Really?! ExtensionData is a special WCF property used to store unrecognized data in (for forward compatibility purposes). The Core Service doesn't return Application Data together with the rest of the object's state, so if your claim is true, somebody must have done a really "creative" implementation of Get-TridionPublications! – Rick Pannekoek Mar 10 at 21:05
    
You're correct Rick - I was a bit quick off the mark there... I have access to what I need through the ReadAllApplicationData method and the ExtensionData isn't the app data 'object' and can be removed from the example above (I'd played with this a little and had tried to access via ExensionData) - I'll spend a little more time cleaning up the code (probably ending up with something more attuned to the appdata companion if time permits – Dylan .. Mark Saunders Mar 11 at 1:28

I have a function that does it this way:

#Example call:     $appData2 = Get-TridionApplicationData -ObjectId $pubId -ApplicationId "tm:ItemTranslationOptions" -Verbose

here's the guts of the function code

$client = Get-TridionCoreServiceClient
$ad = $client.ReadApplicationData($ObjectId, $ApplicationId)
if ($ad -ne $null)
{
$data = [System.Text.Encoding]::UTF8.GetString($ad.Data)
return $data
}
share|improve this answer
    
This is pretty much what I've done in the modules (on a feature branch at the moment). Some of the app data is using a different encoding, though. I apologize in advance for the future naming conflict :) – Peter Kjaer Mar 11 at 16:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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