Senthilkumar kumarasamy

Hi every one,

i developed addin for microsoft outlook 2003.This addin is mainly for archiving mail items. First thing it will store the mail item that is going to be archieved, in the Temp folder.It is working fine in our end as weel as in customer end.

but one of our client reports problem in archiving. Through log file i came to know it is not getting saved on Temp folder and throws the exception while saving the mail item as olMSG format.

private void SaveMessages( string path, OutlookItems items )
{
_docs.Clear();

int i = 1;
foreach( OutlookItem item in items )
{
// create ExchangeLink document
ExchangeLinkDocument doc = new ExchangeLinkDocument( elDocType.elDocMessage );
// first create a new subfolder for the message
string subfolder = String.Format( "{0Big Smile10}", i++ );
subfolder = System.IO.Path.Combine( path, subfolder );
System.IO.Directory.CreateDirectory( subfolder );
// save the message
item.SaveAs( subfolder, Outlook.OlSaveAsType.olMSG, "data" );
doc.DocumentFolder = subfolder;
doc.Attributes = item.Attributes;

_docs.Add( doc );
}

}
public virtual void SaveAs( string path, OlSaveAsType type, string baseName )
{
string filename = "";
filename = System.IO.Path.Combine( path, baseName );
// if the base name is "note" (indicating the note component) do not add the extension
if( 0 != string.Compare( baseName, "note", true ))
{
filename = System.IO.Path.ChangeExtension( filename, ( type.ToString()).Substring( 2 ));//add .MSG extesion to the file

//(%temp%\ExchangeLink.XXX\00001\data.MSG)


}

//filename=(%temp%\ExchangeLink.XXX\00001\data.MSG type=Outlook.olSaveasType.olMSG
Save( filename, type );
\\Exception is thrown in this line

}

Exception details:
Operation aborted (exception of HRESULT: 0x80004004 E_ABORT)) with Outlook._MailItem.SaveAs(String Path, Object type) with MyAddin.ExchangeLink.OutlookObject.OutlookMailItem.Save(String file name, OlSaveAsType type) with MyAddin.ExchangeLink.OutlookObject.OutlookItem.SaveAs(String path, OlSaveAsType type, stringer cousin name)

Regards

Senthilkumar K