Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Sun, 4 May 2008 18:44:56 -0700 (PDT),    group: microsoft.public.platformsdk.mapi        back       


MSG/Structured Storage Problem   
Hi All,

I'm struggling with an issue with the structured file format for .MSG,
in particular, creating one from an existing message. So, the format,
in particular isn't the real problem (I think)... I've gone over the
MS-OXMSG document and I see where the problem is......

When I'm creating an MSG file (Using CreateTNEFStream on an Istorage
object) all is well. When I create one with one embedded message,
again all is well. When I have multiple emails attached, I get only
the last message. Now, the other messages are there, however under the
sub storage _attach_version1.0_#00000000\substg1.0_3701000D the only
stream under there is _properties_version1.0 and has a size of 0.

Again, the last embedded message attachment is fine, all the settings
are there. Click on the .MSG file and the original message has it's
props (definitely some extra named props - like task ones that don't
make sense), recipients, and all attachments.

I'm pretty sure it has something to do with the streams..... Here is
some psuedo code on what I'm doing. Anyone ever face this before or
have any sugestions?

Thanks,

Dan


CreateMSGFile(message)

	fMsgFile = OpenStreamOnFile()

	TNEFStream = CreateTNEFStream(TNEF_ENCODE | TNEF_PURE)

		_Worker(message,TNEFStream)

			TNEFStream.EncodeRecips()

			message.GetPropList(tagArray)
			ExcludeSomeProps(tagArray)

			TNEFStream.AddProps(TNEF_PROP_CONTAINED | TNEF_PROP_INCLUDE |
TNEF_PROP_MESSAGE_ONLY,tagArray)

			message.GetAttachTable()

			for each atachment in attachmentTable

				att = message.OpenAttachment

					att.GetPropList(tagArray)
					ExcludeSomeProps(tagArray)

					TNEFStream.AddProps(TNEF_PROP_CONTAINED |
TNEF_PROP_INCLUDE,tagArray)


					if att = embedded message
						fMsgFile2 = OpenStreamOnFile()
						TNEFStream2 = CreateTNEFStream(TNEF_ENCODE | TNEF_PURE)
						message2 = att.Open(PR_ATTACH_DATA_OBJ)

						_Worker(message2,TNEFStream2)

						message2.Release()

						TNEFStream2.Finish()
						fMsgFile2.Commit()
						TNEFStream2.Release()
						fMsgFile.Seek(beggining of stream)

						// Adds the IStreamTNEF as attachment data
						TNEFStream.AddProps(TNEF_PROP_CONTAINED_TNEF |
TNEF_PROP_INCLUDE,PR_ATTACH_DATA_OBJ, fMsgFile)

						att.Release()
					end if
			end for

			// Clean up recipient objects, prop arrays but NOT fMsgFile2, that
is done later because
			// it seems to crash if I release it earlier.
		END _Worker


	TNEFStream.Finish()

	fMsgFile.Commit()

	// NOW clean up all the fMsgFile2 items we collected

	TNEFStream.Release()
	fMsgFile.Release()

END
date: Sun, 4 May 2008 18:44:56 -0700 (PDT)   author:   dang

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us