MailItem.save() Method

D

Dmitry Streblechenko

It is true that C# per se does not have a particular purpose, but .Net
itself severely limits what you can do: lack of pointers and other low level
pieces are the biggest problem. One can argue that it is a good thing from
an academic point of view, but unfortunately we live in a real world where
COM will stay very much alive for years to come.
..Net does have a huge number of very nice features, but driving Outlook is
not one of them unfortunately.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
A

Austin Stephens

Ok, Ok, I give but the C# discussions don’t have heavy experience with Outlook.

I had my question answered completely. However, I found I need to use Sue’s
Form Launcher Application. So I have to force my MailItem into a specific
folder. So I wrote:

MailItem newItem = (MailItem) syncFolder.Items.Add(OlItemType.olMailItem);

The variable “syncFolder†was set by “walking the Folder tree†and returning
a correct MAPIFolder.

So my question now is how do I save the newItem? I cannot seem to get
anything to save in the folder syncFolder.



Thanks...
Austin
 
S

Sue Mosher [MVP-Outlook]

What kind of folder is it? You need proper permissions, non-search folder,
etc.

You do call the Save method somewhere in your procedure, right?
 
A

Austin Stephens

Sue,

Hello, are we having fun yet?

The folder is on my personal laptop running Office 2002 in the [Personal
Folders] group. No Exchange Server in site. (xp pro)

I tried newItem.Save(); and it placed the folder in the Drafts Folder. I
then used newItem.Actions.Add(); and nothing happened, that I can see.

Thanks...
Austin
 
J

Jim Vierra

Until 7 years ago I coded everything in C or C++. VB6 made me look beyond C
for a change.

The gist of this thread, if I am getting it right, is not C# as a language
but the use of C# to extend C.

I agree that access to Outlook via C# is silly. Outlook shouldn't need
external automation as it provides no dramatic benefits which was my
argument all along except that this thread was about errors encountered and
not the viability of C# with Outlook.

Cs.NET works with Outlook once you get past certain issues with the
documentation of the Interop. It also seems to have some issues with doing
late-bound activation but that may just be an error that I am causing. This
is one thing I am trying to figure out as it affects Word as well as
Outlook.

I would say don't give up on C#. .NET 2.0 and VSTO will certainly make
CS.NET one of the choices for add-ins as well as automation of Office from
your custom applications.
 
J

Jim Vierra

Now we know the "real" truth about Dmitry. He's a closet Delphi developer.

I agree that for COM VB6 is about as good as it gets as far as simplicity
goes. VB6 builds COM and consumes COM with little effort. The first time I
built an object that sat on a web server and produced data and tried a
remote debugging session I thought I had found the pot of gold at the end of
a rainbow. AND WITH VB!

Unfortunately people...we will have to move on to .NET languages for future
versions of Office so ...
 
A

Austin Stephens

Jim,

COM will never interest me. All my past programming was moving data from
one computer to another. Today it’s still client/server and I’m back to
using TCPScockets, (a COM object, yes). I have to currently rely on Ack and
Nac to communicate with messages. In fact the MailItem I’m trying to save
was sent piece by piece, from the server on my home network. I have done
quite a bit of programming and my “proof of concept†was based on dumping the
MailItem into the Drafts folder. That will not work now and cannot figure
out why I can’t save it to a given folder, it may have something to do with
“saving a mailmessage†and I may have to have to wrap the message in Sue’s
Launcher. (programmatically???) . All in a days work. And this is all done
in the console... think about it. C# has to talk to Office trust me.


Thanks...
Austin
 
S

Sue Mosher [MVP-Outlook]

Ah, that's normal behavior for MailItem. Messages are designed to be sent,
not saved. If you want to save it somewhere other than the Drafts folder,
create and save the item, then move it to the desired location.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Austin Stephens said:
Sue,

Hello, are we having fun yet?

The folder is on my personal laptop running Office 2002 in the [Personal
Folders] group. No Exchange Server in site. (xp pro)

I tried newItem.Save(); and it placed the folder in the Drafts Folder. I
then used newItem.Actions.Add(); and nothing happened, that I can see.

Thanks...
Austin


Sue Mosher said:
What kind of folder is it? You need proper permissions, non-search
folder,
etc.

You do call the Save method somewhere in your procedure, right?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

Jim Vierra

Are you saying you are using scripting to do this?

What is the requirement that makes this necessary? Perhaps there is a
different way to accomplish the task that is outside of Office development
altogether. I have built many work around systems in many languages so my
toolkit is full of strange items.

Using TCP either direct or sockets is still a viable method in much of the
world although it is slowly being replaced by SOAP and web services on
nearly all platforms. I like sockets and rpc but realize how much better
behaved the new tools are.

Anyway, access to Office apps is COM and your stuck with it. It's actually
much better than the old library call API as it resolves much of the
interface compatibility issues.
 
D

Dmitry Streblechenko

Yes, but the closet is pretty comfortable :)
I have projects in both Delphi and VC++. .Net and VB are only for
testing/playing...
I still think that Delphi is hands down the best environment for the Win 32
development, but unfortunately Borland is a company with huge management and
ego problems. You can almost count on them to take a wrong turn at every
crossroad. Worse yet still still kid themselves that they are in the same
league as Microsoft, even if they are stretched razor thin on a bunch of
useless projects (Kylix anyone?) and everybody who ever meant anything at
Borland now works for Microsoft.
Delphi 5 was great, but it all went downhill from version 6... On well, as
long as I still have the CD...

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
A

Austin Stephens

Jim,

First, I should have said that I do not believe I will be developing in COM.

Not sure how you use the term scripting, I would call mine messaging. And
yes I will drop the sockets and turn this application into a web service
where the two (or more) computers will have to go through the web service. I
did a lot of development using troff and nroff so XML looks real friendly to
me.

Oh well, today I’m going to solve my errant MailItem.Save() problems. I’m
still very early in my learning curve.

Oh, what makes this necessary? My wife and I would have to set up an
Exchange server.

Thanks...
Austin
 
K

Ken Slovak - [MVP - Outlook]

Actually we should have COM development for Office for at least the next
version or 2 so that gives us at least another 4 - 5 years. And I'm not
convinced that .NET will exist, at least in its current form, by then.
There's nothing that can be done with any Office programming, especially for
COM addins, that can be done with .NET code that can't be done with COM code
and with a lot fewer problems, faster code and smaller code. And much easier
support for multiple versions of Outlook.

As another Outlook developer MVP once said, there's no compelling story for
developing for Outlook with .NET and you won't find any of the Outlook
developer MVP's who do develop in .NET unless they are forced to do so by a
client for a specific project.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top