2014-04-08 2 views
2

나는 아웃룩 2010을 사용하고의 읽기받은 편지함 - 내 주요 사서함이 있습니다 [email protected]파이썬 전망 : 추가 사서함

을 나는 또한 내 프로필에 다른 사서함 추가 : 메가 데이터 시저를

두 가지 모두 Outlook에서 최상위 폴더로 표시됩니다.

[email protected] 
-Inbox 
-Sent Items 
-Deleted Items 

mb data proc 
-Inbox 
-Sent Items 
-Deleted Items 

추가 사서함에 대해 다른 프로필을 만들 수 없습니다. 같은 프로필에 추가되었습니다.

"mb data proc"편지함에서받은 편지함에 대한 참조를 얻으려면 어떻게해야합니까?

여기에 설명 된 것과 동일한 문제가 Get reference to additional Inbox이지만 VBS에서 발생합니다.

파이썬으로하는 방법?

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") 
folder=outlook.Folders("mb data proc") 
msg=folder.Items 
msgs=msg.GetLast() 
print msgs  

나는이 시도하지만 난이 오류 :

 folder=outlook.Folders("mb data proc") 
AttributeError: _Folders instance has no __call__ method 

답변

-1

첫째, 당신이 방법을 Namespace.GetSharedDefaultFolder 사용할 수 있습니다.

둘째, 다음 라인

folder=outlook.Folders("mb data proc")

요구

folder=outlook.Folders.Item("mb data proc")

0

는 게시물 주셔서 감사합니다 수 있습니다!

이 내 첫 번째 게시물, 그래서 내가 제대로에서 코드를 복사 희망 : 여기

def check_shared(namespace,recip = None): 
    """Function takes two arguments: 
     .) Names-Space: e.g.: 
      which is set in the following way: outlook = Dispatch("Outlook.Application").GetNamespace("MAPI") and 
     .) Recipient of an eventual shared account as string: e.g.: Shared e-Mail adress is "[email protected]" 
      --> This is optional --> If not added, the standard-e-Mail is read out""" 


    if recip is None: 
     for i in range(1,100):       
      try: 
       inbox = namespace.GetDefaultFolder(i)  
       print ("%i %s" % (i,inbox))    
      except: 
       #print ("%i does not work"%i) 
       continue 
    else: 
     print('The folders from the following shared account will be printed: '+recip) 
     tmpRecipient = outlook.CreateRecipient(recip) 
     for i in range(1,100):       
      try: 
       inbox = namespace.GetSharedDefaultFolder(tmpRecipient, i)  
       print ("%i %s" % (i,inbox))    
      except: 
       #print ("%i does not work"%i) 
       continue 
    print("Done") 
1

는 간단 여기 가능한 폴더를 읽을 수있는 내가 함께 사용자의 입력에 따라 뽑아 함수입니다 해결책. 나는 당신이 놓친 유일한 부분이 "Inbox" 내부의 폴더 "mb data proc"에 도착하고 있었다고 생각합니다.

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") 
folder = outlook.Folders("mb data proc") 
inbox = folder.Folders("Inbox") 
msg = inbox.Items 
msgs = msg.GetLast() 
print msgs