473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Accessing Outlook Public Folders

Bob
Hi,

I'm new to Python and I want to create a script that will import
contactitems into an Outlook Public Folder.
Therefore I've installed the Python for Windows Extensions.

This way I can access my personal contacts

<code>
import win32com.client

OutlookObj = win32com.client.Dispatch("Outlook.Application")

Nms = OutlookObj.GetNameSpace("MAPI")
# Personal contacts folder
custs = Nms.GetDefaultFolder(10).Items

print custs.count

for i in range(custs.count):
cust = custs[i]
print cust.FullName + " -> " + cust.FileAs
</code>
But when I try to access contacts in the public folder 'klanten' with
this code I get an error.

<code>
import win32com.client

OutlookObj = win32com.client.Dispatch("Outlook.Application")

Nms = OutlookObj.GetNameSpace("MAPI")
# Folder Klanten from public folders
custs = Nms.Folders.Item("Public Folders").Folders.Item("All Public
Folders").Folders["Klanten"].Items

print custs.count

for i in range(custs.count):
cust = custs[i]
print cust.FullName + " -> " + cust.FileAs
</code>

<error>
Traceback (most recent call last):
File "D:\PythonScripts\tp2outlook.py", line 13, in -toplevel-
print cust.FullName + " -> " + cust.FileAs
File "D:\Python23\Lib\site-packages\win32com\client\dynamic.py", line
489, in __getattr__
raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: <unknown>.FullName
</error>

Anyone an idea how I can access those contactitems?

Thanks,

Bob
Nov 25 '05 #1
0 1871

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Li Pang | last post by:
Hi, I wrote the following codes to read messages. They work fine for Outlook 2002 but fails for 2003. My felling it may be a bug of Outlook 2003. Anybody has experience on that? Thanks in...
0
by: ratnakarp | last post by:
Is there any way i can improve on this code? If i run this application by giving the detials of the start date and end date in the range of 15 days, it's taking 3 mins. I'm looking for a code...
0
by: mikael.palmblad | last post by:
I can't get this thing to work. I'm trying to export contacts to a specific folder in Outlook but I can't get the folder. I have several examples on how to do it by there is one function that don't...
5
by: Arno R | last post by:
Hi all, I need to get at specific (shared) agenda-data from MS outlook 2003. I need every day to get the scheduled 'appointments' for some rooms to Access. In Access I will show the...
1
by: PhilD | last post by:
My C#.NET console app checks a public folder every 24 hours for incoming emails. For each unread email in the folder, it copies any attachments to the network, then loads the contents of these files...
1
NarenMCA
by: NarenMCA | last post by:
Hi, The below code in MS Outlook gives me the names of folders in "public folders". I am looking forward to get all the subfolders and files in "Public folders" Please assist me in this. ...
0
by: jazeelkm | last post by:
Hi , I am developing a windows application using C#. In that I want to display all the outlook profiles in a listbox and on selecting one, The folder structure should be displayed on a treeview...
0
by: davidiwharper | last post by:
Hello all I am trying to modify a CDO script that moves email messages out of a user's inbox and into a drop folder. I want to update it to use a Public Folder instead. The portion of the...
0
by: printline | last post by:
Hello I have the following macro for outlook: Dim oApp As Application Dim oNS As NameSpace Dim oMsg As Object Dim bDoAction As Boolean Dim oAttachments As Outlook.Attachments
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.