Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » Entourage - AppleScript to Store Contact Categories
  •  
simeli

Messages: 3
Karma: 0
Send a private message to this user
I' wrote an AppleScript that lets you backup Categories associated to Contacts by writing them to the notes field. Restore works similarly by reading the notes field for category entries.

The sscript is very helpful in case you have to rebuild the Entourage database because in such a case all categories are lost because they are not stored on the server.

Entourage unfortunately has no way of accessing the public contacts folder, thus you cannot share the same categories across machines. This was my intention on achieving when I started writing this.

the script works only if the kerio exchange account is the standard account.

store script

property catHeader : "Category: "
set {oldDelims, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {return}}
tell application "Microsoft Entourage"
	set theContacts to (every contact)
	tell theContacts
		repeat with theContact in theContacts
			set thisContent to paragraphs of (get description of theContact)
			set catLine to catHeader
			set theCats to category of theContact
			if theCats ? {} then
				repeat with aCat in theCats
					set catLine to catLine & name of aCat & ", "
				end repeat
				set catLine to text 1 thru -3 of catLine
				if (thisContent as text) contains catHeader then
					repeat with aLine in thisContent
						if aLine starts with catHeader then
							set aLine to catLine
							exit repeat
						end if
					end repeat
				else
					copy catLine to end of thisContent
				end if
				set description of theContact to thisContent as Unicode text
			end if
		end repeat
	end tell
end tell
set AppleScript's text item delimiters to oldDelims


restore
property catHeader : "Category: "
set {oldDelims, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {", "}}
tell application "Microsoft Entourage"
	set theContacts to (every contact)
	set catHeaderLength to 1 + (length of catHeader)
	repeat with theContact in theContacts
		set thisContent to paragraphs of (get description of theContact)
		if (thisContent as text) contains catHeader then
			repeat with aLine in thisContent
				if aLine starts with catHeader then
					set catNames to text items of (text catHeaderLength thru -1 of aLine)
					set catList to {}
					repeat with aCatName in catNames
						try
							copy category aCatName to end of catList
						on error errMsg number errNum
							if errNum = -1728 then
								make new category with properties {name:aCatName}
								copy category aCatName to end of catList
							end if
						end try
					end repeat
					set category of theContact to catList
					exit repeat
				end if
			end repeat
		end if
	end repeat
end tell
set AppleScript's text item delimiters to oldDelims
Previous Topic: .. KOC and Linux along with Kerberos via A/D
Next Topic: Forwarding and autoresponding to messages
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Fri Nov 24 19:33:06 CET 2017

Total time taken to generate the page: 0.00351 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.