473,568 Members | 2,939 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Outlook-MAPI

Hi there,

Can any one please help in getting me Python-Outlook
programming issue clarified.

I just wanted to do the following using Python:

1)Open a New Oulook Mail Window

2) Fill the field: to-email address and Write some body to it.(I
DON't want to send it automatically)

That's all. But, I am getting an error when I try to initiate the
MAPI-Session using

object = win32com.client .Dispatch("Outl ook.Application ")

ns = object.GetNames pace("MAPI")

mapi = win32com.client .dynamic.Dispat ch("MAPI.sessio n")

Error I see is :

File "C:\Program Files\GNU\WinCv s 2.0\Macros\Temp lateCvsMacro.py ",
line 140, in SendMAPIMail

mapi = win32com.client .Dispatch("MAPI .session")

File "C:\Python24\Li b\site-packages\win32c om\client\__ini t__.py",
line 95, in Dispatch

dispatch, userName = dynamic._GetGoo dDispatchAndUse rName
(dispatch,userN ame,clsctx)

File "C:\Python24\Li b\site-packages\win32c om\client\dynam ic.py",
line 91, in _GetGoodDispatc hAndUserName

return (_GetGoodDispat ch(IDispatch, clsctx), userName)

File "C:\Python24\Li b\site-packages\win32c om\client\dynam ic.py",
line 79, in _GetGoodDispatc h

IDispatch = pythoncom.CoCre ateInstance(IDi spatch, None, clsctx,
pythoncom.IID_I Dispatch)

pywintypes.com_ error: (-2147221005, 'Invalid class string', None,
None)

Can any one please help me in this regard.

Thanks,

Sekhar

Jul 19 '05 #1
1 8770
This code should help.

code
import win32com.client
olMailItem = 0x0
obj = win32com.client .Dispatch("Outl ook.Application ")
newMail = obj.CreateItem( olMailItem)
newMail.Subject = "This works"
newMail.Body = "It worked aging\n"
newMail.display ()
V.C.Sekhar wrote:
Hi there,

Can any one please help in getting me Python-Outlook
programming issue clarified.

I just wanted to do the following using Python:

1)Open a New Oulook Mail Window

2) Fill the field: to-email address and Write some body to it.(I
DON't want to send it automatically)

That's all. But, I am getting an error when I try to initiate the
MAPI-Session using

object = win32com.client .Dispatch("Outl ook.Application ")

ns = object.GetNames pace("MAPI")

mapi = win32com.client .dynamic.Dispat ch("MAPI.sessio n")

Error I see is :

File "C:\Program Files\GNU\WinCv s 2.0\Macros\Temp lateCvsMacro.py ",
line 140, in SendMAPIMail

mapi = win32com.client .Dispatch("MAPI .session")

File "C:\Python24\Li b\site-packages\win32c om\client\__ini t__.py",
line 95, in Dispatch

dispatch, userName = dynamic._GetGoo dDispatchAndUse rName
(dispatch,userN ame,clsctx)

File "C:\Python24\Li b\site-packages\win32c om\client\dynam ic.py",
line 91, in _GetGoodDispatc hAndUserName

return (_GetGoodDispat ch(IDispatch, clsctx), userName)

File "C:\Python24\Li b\site-packages\win32c om\client\dynam ic.py",
line 79, in _GetGoodDispatc h

IDispatch = pythoncom.CoCre ateInstance(IDi spatch, None, clsctx,
pythoncom.IID_I Dispatch)

pywintypes.com_ error: (-2147221005, 'Invalid class string', None,
None)

Can any one please help me in this regard.

Thanks,

Sekhar


Jul 19 '05 #2

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

Similar topics

3
4979
by: deko | last post by:
When adding Outlook Appointment Items from Access, should I use: Set ol = New Outlook.Application --or-- Set ol = CreateObject("Outlook.Application") Outlook seems to crash either way. The Outlook application (and/or Calendar) may or may not be open when this sub runs.
3
4527
by: Jyothi | last post by:
Hi All, Thanks for ur reply for my previous postings. I have a question. I wanted to show the outlook inbox in a window with minimal options like send,delete,reply,forward,replytoall,new message. how do i achieve that. Is there any option in C# where i can perform this using the native support of .NET framework?
0
3787
by: Martin Knauer | last post by:
Hi, I try to build an Outlook Plugin. After having some trouble with the Inspectorevents I'm trying to build a wrapper for the Inspectorclass. However I'm stuck again after letting VS.Net 2003 create the stubs for the Inspector-Interface. When I try to compile the new Wrapperclass it says
10
2827
by: John | last post by:
Hi When I open a new outlook email from vb.net, sometimes outlook is very slow to appear or occasionally outlook freezes completely. I am targeting mixed office2000/xp environments so I am using the office2000 interop dlls generated by vs.net by adding office 2000 com reference. Any one else noticed this problem when targeting...
9
6721
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
6
4540
by: Ernie | last post by:
We have an Outlook 2000 VBA application - 8 user forms, and about a thousand lines of code - that we wish to distribute. We know that we can password-protect the code, but that does not give us the desired level of security We plan to use VB.NET to create an executable file which we will distribute to our users. We have tested this, and it...
26
4479
by: Tom Becker | last post by:
Is there a way, from Access, to programmatically click the Send and Receive button in Outlook?
1
4852
by: dcd | last post by:
Hi all I'm using trying to get my app to read in all contacts in the contact folder of Outlook. I'm using the Outlook Security manager to stop the pop up warnings. Outlook version is 2002(10.2627.2625) I can create a contact in Outlook and I can use it to send an email. It's just the getting the contacts list that doesn't work. The thing is it...
9
2237
by: ARC | last post by:
In case anyone has ran into this yet. The following code used to work with older versions of the MS Outlook library, but would error out in 2007: Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment Set objOutlook =...
5
2408
by: fniles | last post by:
I am using VB.NET 2005. I created a project using the Microsoft Outlook 8.0 Object Library (Object Model) in my previous machine. Now that I have a new machine, when I try to compile that program in the new machine, it gives me erros like "Type 'Outlook.Application' is not defined", "Type 'Outlook.NameSpace' is not defined". I have MS Outlook...
0
7604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8117
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.