Product SiteDocumentation Site

4.7. Writing data

Until now we have only been reading data from MAPI. The most important ways of writing data to MAPI are:
However, if you were to simply take the code we have created until now and added any of these functions, an exception would be raised. This is because all the flags we have been passing were 0, and most functions default to read-only access. The calls we have to change are:
This allows you to write to the objects:
message.SetProps([SPropValue(PR_SUBJECT, 'new subject')])
stream.Write('hello')

Note

Although changes on messages are not saved to disk until SaveChanges() is called on messages, changes on folders and stores are immediate and do not require a SaveChanges() call.