Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Defines an object used to manage a collection of BodyPart objects.
None
Instances of the BodyParts COM class cannot be created directly. An object reference is always returned by BodyParts properties on other interfaces, such as the IBodyPart::BodyParts property.
Dim iMsg as new CDO.Message Dim iBp as CDO.IBodyPart Dim iBps as CDO.IBodyParts iMsg.AddAttachment "c:\somefile.html" iMsg.AddAttachment "c:\anotherfile.doc" iMsg.CreateMHTMLBody "http://myserver/mypage.html", cdoSuppressAll Set iBp = iMsg Debug.Print "Root content-type: " & iBp.ContentMediaType Set iBps = iBp.BodyParts ' loop through attachments Dim i as Integer For Each iBp in iBps Debug.Print "Level 1, item " & i & " " & iBp.ContentMediaType i = i + 1 Next iBp ' set recipients, etc iMsg.Send
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace #import "c:\winnt\system32\cdosys.dll" no_namespace #include <iostream.h> #include <assert.h> main(){ CoInitialize(NULL); // single-threaded apartment { IBodyPartPtr iBp; IBodyPartsPtr iBps; IMessagePtr iMsg(__uuidof(Message)); iMsg->AddAttachment("c:\somefile.html","",""); iMsg->AddAttachment("c:\anotherfile.doc","",""); iMsg->CreateMHTMLBody("http://www.microsoft.com", cdoSuppressAll,"",""); iBp = iMsg; // print the content media types for the body parts // this will print "multipart/mixed" cout << "Root content-type: " << iBp->ContentMediaType << endl; iBps = iBp->BodyParts; for(long i = 1;i<=iBps->Count;i++) { iBp = iBps->item[i]; cout << "level 1, item " << i << " " << iBp->ContentMediaType << endl; } // in the above loop, you will get "multipart/alternative" // and, depending upon the attachments, something like // "text/html" // "application/octet-stream" // set recipients, etc iMsg->Send(); } CoUninitialize(); return 0; }