2013-07-09 7 views
1

접촉이보다 존재하지 않는 경우를 결정하는보다 효율적인 방법이 :검색 Outlook 연락처 mdfind

set theAddress to "[email protected]" 

set found to false 

repeat with aContact in contacts 

    if email addresses of aContact contains theAddress then 
    set found to true 
    exit repeat 
    end if 

end repeat 

if not found then 
    ... 
end if 

이 새 연락처를 만듭니다가 발견되지 않는 경우가 (그리고 true을 반환) :

set found to open contact email address "[email protected]" 

** 편집 **

Search Outlook contacts by category 내가 스포트라이트 쿼리를 사용하여이 작업을 수행 할 수 있어야한다고 제안 :

-- the address to be found 
set theEmailAddress to "[email protected]" 

-- search identity folder 
set currentIdentityFolder to quoted form of POSIX path of (current identity folder as string) 

--perform Spotlight query 
set theContacts to words of (do shell script "mdfind -onlyin " & currentIdentityFolder & " 'kMDItemContentType == com.microsoft.outlook14.contact && [metadata element that represents an email address] == " & theEmailAddress & "' | xargs -I % mdls -name com_microsoft_outlook_recordID '%' | cut -d'=' -f2 | sort -u | paste -s -") 

-- process results 
... 

연락처의 이메일 주소를 나타내는 메타 데이터 요소는 무엇입니까?

답변

0

당신이 찾고있는 메타 데이터 요소는 kMDItemEmailAddresses입니다. 찾을 수있는 많은 검색이 있었음을 인정하지만, Apple's developer library에서 그 이상을 찾을 수 있습니다.

나를 위해 일한

쉘 명령 (애플 스크립트에 포장 독자들에게 운동입니다) :

mdfind 'kMDItemContentType == com.microsoft.outlook14.contact && kMDItemEmailAddresses == "[email protected]"' 
관련 문제