I am currently working in COM to open a DXL file in Lotus. I have no control over how a user sets their homepage (the generic “-Welcome-” screen or set Mail as Homepage).When a user happens to set their Mail bookmark as their homepage, I am unable to open the DXL in Lotus Notes,
Please bear with me, this is not the entire code because I am not allowed to post everything (return values dismissed to make this as short as possible)
lnSession = new NOTESSESSION;
lnWorkspace = new NOTESUIWORKSPACE;
bstr_t strMailType = lnSession->GETENVIRONMENTSTRING( “MailType”, COleVariant((short)TRUE) );
bstr_t strMailServer = lnSession->GETENVIRONMENTSTRING( “MailServer”, COleVariant((short)TRUE) );
//Do some extra work to get abbreviated, if needed
bstr_t strMailFile = lnSession->GETENVIRONMENTSTRING( “MailFile”, COleVariant((short)TRUE) );
VARIANT vtFalse;
vtFalse.boolVal = VARIANT_FALSE;
vtFalse.vt = VT_BOOL;
VARIANT vtDB = lnSession->GETDATABASE( strServerName, strUserMailFilePath, vtFalse );
NOTESDATABASE lnDB;
(&lbDB)->AttachDispatch( vtDB.pdispVal, TRUE );
lnWorkspace->RELOADWINDOW();
VARIANT vtView = lnWorkspace->GetCurrentview(); //Only gets a view if the physically on view in Notes and not set as Homepage
// Check to see that a valid view was returned, if not we’re still OK
variant_t vtName( “” );
if( vtView.pdispVal != NULL )
{
NOTESUIVIEW lnUIView;
(&lnUIView)->AttachDispatch( vtView.pdispVal, TRUE );
vtName = lnUIView.GetViewname();
// Release our UIView
lnUIView.ReleaseDispatch();
}
// Make sure we have a valid BSTR for the view name
bstr_t bstrView( vtName.bstrVal );
if( vtName.bstrVal )
{
/* We need to check to see if our current view is SoftDeletions
since this will cause issues when viewing the imported DXL */
bstr_t bstrViewName( vtName.bstrVal, false );
if( _tcscmp( bstrViewName, "($SoftDeletions)" ) == 0 )
{
bSoftDeletions = true;
/*Try and get the ($All) view*/
bstrView = "($All)";
variant_t vtView;
vtView = lnDB->GETVIEW( bstrView );
if( vtView.pdispVal == NULL )
{
// The ($All) view is missing, set the view name to blank for the default view
bstrView = "";
}
}
}
variant_t vtOpen = lnDB.GetIsopen();
if( vtOpen.boolVal != VARIANT_TRUE )
{
/* Open the view properly */
hRes = OpenDatabase( strServerName, strUserMailFilePath, bstrView );
VERIFYHRES( hRes );
}
else if( bSoftDeletions )
{
/* The DB is already open, just open the proper view */
hRes = OpenView( bstrView );
VERIFYHRES( hRes );
}
VARIANT vtStream = lnSession->CREATESTREAM();
NOTESSTREAM lnStream;
(&lnStream)->AttachDispatch( vtStream.pdispVal, TRUE );
bstr_t strCharset(“Binary”);
VARIANT vtCharset;
vtCharset.vt = VT_BSTR;
vtCharset.bstrVal = strCharset;
(&lnStream)->OPEN( szFilePath, vtCharset );
VARIANT vtImport = lnSession->CREATEDXLIMPORTER( vtStream, vtDB );
NOTESDXLIMPORTER lnImporter;
(&lnImporter )->AttachDispatch( vtImport.pdispVal, TRUE );
(&lnImporter)->PROCESS();
lnWorkspace->VIEWREFRESH();
bstr_t strNoteID;
strNoteID = (&lnImporter)->GETFIRSTIMPORTEDNOTEID();
VARIANT vtDoc;
vtDoc = (&lnDB)->GETDOCUMENTBYID( strNoteID );
NOTESDOCUMENT lnDoc;
(&lnDoc)->AttachDispatch( vtDoc.pdispVal, TRUE );
VARIANT vtFalse;
vtFalse.boolVal = VARIANT_FALSE;
vtFalse.vt = VT_BOOL;
(&lnDoc)->SAVE( TRUE, FALSE, vtFalse );
lnWorkspace->EDITDOCUMENT( false, vtDoc, true, vtMissing, false, false );
//When a user has their Mail Bookmark set as their HomePage, this fails to open the new document in Notes.
//Clean up
Anyone have any ideas? I have been attempting to get the current view upon opening, but that does not seem accurate. Any help would be appreciated.
Thanks