Skip to content

Commit c74ef6f

Browse files
author
Prabhu
committed
Added getByUID
1 parent 0687f52 commit c74ef6f

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

addressbook.py

+20-13
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ def all():
2828
"""
2929
return _clist(getAddressBook().people())
3030

31+
def groups():
32+
"""
33+
Return groups
34+
"""
35+
return _clist(getAddressBook().groups())
36+
37+
def me():
38+
"""
39+
Returns the current logged in user.
40+
"""
41+
return _clist([getAddressBook().me()])[0]
42+
43+
def getByUID(uid):
44+
"""
45+
Returns a person or group by uid.
46+
"""
47+
return _clist([getAddressBook().recordForUniqueId_(uid)])[0]
48+
3149
def _clist(slist):
3250
"""
3351
Method to convert NSArray to python list
@@ -48,18 +66,6 @@ def _clist(slist):
4866
retList.append(aobj)
4967
return retList
5068

51-
def groups():
52-
"""
53-
Return groups
54-
"""
55-
return _clist(getAddressBook().groups())
56-
57-
def me():
58-
"""
59-
Returns the current logged in user.
60-
"""
61-
return _clist([getAddressBook().me()])[0]
62-
6369
def _getVal(tmpval):
6470
"""
6571
Extract value from unicode or Date object.
@@ -76,7 +82,8 @@ def _getVal(tmpval):
7682
def main():
7783
#print all()
7884
#print groups()
79-
print me()
85+
#print me()
86+
#print getByUID('B50984C8-FEAC-4D6A-8B77-E271DB729A8E:ABPerson')
8087

8188
if __name__ == '__main__':
8289
main()

0 commit comments

Comments
 (0)