Script funktioniert nicht korrekt

Ich nutze dieses Script (stammt aus diesem Forum) um Emails zu datieren und umzubenennen. Leider Funktioniert die Übertragung des Betreffs nicht, hier wird immer nur “no subject” produziert.

Was muss ich ändern, damit der Betreff der Email übernommen wird?

tell application "DEVONthink Pro Office"
	set theSelection to the selection
	repeat with theRecord in theSelection
		set theDate to creation date of theRecord
		set theMD to meta data of theRecord
		
		try
			set theSubject to |kMDItemHeadline| of theMD
			if theSubject is missing value or theSubject is "" then error
		on error
			set theSubject to "No subject"
		end try
		
		try
			set theSender to |kMDItemAuthors| of theMD
			if theSender is missing value or theSender is "" then error
		on error
			set theSender to |kMDItemAuthorEmailAddresses| of theMD
		end try
		
		set theRecipient to |kMDItemRecipientEmailAddresses| of theMD
		set theName to ((year of theDate) as string) & "-" & my formattedNumber((month of theDate) as integer) & "-" & my formattedNumber(day of theDate)
		set theName to theName & " " & theSender & " > " & theRecipient & ": " & theSubject
		set name of theRecord to theName
	end repeat
end tell

on formattedNumber(theNumber)
	if theNumber < 10 then
		return "0" & (theNumber as string)
	end if
	return (theNumber as string)
end formattedNumber

Klappt es mit kMDItemSubject anstatt kMDItemHeadline?

Damit klappt es. Danke