Mark Hogan

I am getting error 0x80040F04 while accessing properties of Objects from Outlook. I can not test on these computers as they are not my systems (I am not having these issues and neither are most users, but some have this error). Basically, when ever the program tries to access a property, such as Name, the VSTO throws error 0x80040F04. They have Office 2003 installed and the proper support files. They have the service packs up to date (Windows and Office).

So, what can I do
Has this been seen before
Any ideas

Thanks,
Mark Hogan

Here is some code from the program and where the error occurs.

Module modArchivER
Private ERROR_FILE_NOT_FOUND As Integer = 2
Private ERROR_ACCESS_DENIED As Integer = 5

Public _AppOutlook As Outlook.Application
Public oNameSpc As Outlook.NameSpace
Public OutLookVersion As Long
<...>

public class ThisApplication
Private WithEvents _AppOutlook As Outlook.Application = Nothing
<...>

Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
_AppOutlook = Me.Session.Application
modArchivER._AppOutlook = Me.Session.Application
modArchivER.oNameSpc = modArchivER._AppOutlook.GetNamespace("MAPI")
<...>

Option Explicit On
Public Class frmMain
<...>

Sub LoadOutlookFolders()
<...>
oFolders = oNameSpc.Folders
For i = 1 To oFolders.Count


oFolders.Item(i).Name 'This Generates the Error.
<...>



Re: Visual Studio Tools for Office Outlook configuration Problem

Mei Liang - MSFT

Outlook 2003 has severely restricted the object model for S/MIME encrypted
messages, signed messages with S/MIME receipt requests, and S/MIME receipts.
In particular, attempting to do an Item.Display (or Reply or Forward) will
result in error 0x80040F04, 0x80040F01 and 0x80040F02 respectively for each
of these message types.

Is the item encrypted


Mei Liang

------------------------------------------------------------------------------------------------------------------------------------------------

This posting is provided "AS IS" with no warranties, and confers no rights.






Re: Visual Studio Tools for Office Outlook configuration Problem

danhood

Hi Mei,

I am currently creating Add-in using Visual Studio Tools for Office which will automate following manual actions:

attachment of the excel file with the unique name (eg excel file starting with MLC word)
and sending it to multiple number of email address that have unique name + number logic (eg MLC1, MLC2,)

At this stage I have resolved two most important issues : mapping the recipients with corresponding files and mappin Z:\ directory to SharePoint so as to open the communication between OutlookAddin and DocumentLibrary(stored excel files) . I have tested it with small fund sample and it takes aroun 1.5-2 second to send an email with appropriate attachments to desired recipient. That's good, but what if there is 156 recipients

Do I really have to create Outlook Addin with almost 12 000 lines of code, as I would be just copying general parts of the code and just changing search entries or it is possible to create a global property or Array List etc that would actually reduce the need for copying of the code all over again. I will show you code in VB.Net as I am not sure which of two (vb.net, c#) you use in your code projects, and let me observe that GetFiles really does outstanding job, and its introduction in Net 2.0 framework was more than welcome. I would highly appreciate if your suggestions are not mare general words but are followed up with general code sample.

Imports Office = Microsoft.Office.Core

Imports System.Xml

Imports System.IO

Imports System.Configuration

Imports System.Collections

Imports System.Net.Mail

Imports System.Web

public class ThisApplication

Private WithEvents _Explorers As Outlook.Explorers

Private WithEvents _Explorer As Outlook.Explorer

Private _contactFolder As Outlook.Explorer

Private _mapiContact As Outlook.MAPIFolder

Private _helpMenuIdex As Object

Private _menuBar As Office.CommandBar

Private WithEvents _Email As Outlook.MailItem

Private Const COMMAND_BAR As String = "EDC"

Private Const BUTTON_NAME As String = "Send_EDC"

Private WithEvents myButton As Office.CommandBarButton

Private Const folder As String = "Z:\GeneratedForms\2006-08"

Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup

_menuBar = Me.ActiveExplorer().CommandBars.Add(COMMAND_BAR, Office.MsoBarPosition.msoBarTop, False, True)

_menuBar.Visible = True

myButton = CType(_menuBar.Controls.Add(Office.MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, True), Office.CommandBarButton)

myButton.Caption = BUTTON_NAME

myButton.Style = Office.MsoButtonStyle.msoButtonIconAndCaption

myButton.Enabled = True

End Sub



Private Sub myButton_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Handles myButton.Click

Try

Call SendEmailtoContacts()

Catch ex As Exception

ex.ToString()

End Try

End Sub

Public Sub SendEmailtoContacts()

Dim objContactItem As Outlook.ContactItem

Dim outlookNameSpace As Outlook.NameSpace = Me.GetNamespace("MAPI")

Dim subjectEmail As String = "EDC"

Dim bodyEmail As String = "text"

'create and instance of the contact folder

Try

_mapiContact = outlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)

For Each objContactItem In _mapiContact.Items.Restrict("[CompanyName] = Intech")

CreateEmailItem(subjectEmail, objContactItem.Email1Address, bodyEmail, "EDC_IMD_Forms")

Next

Catch objexc As Exception

objexc.ToString()

Finally

End Try

End Sub





Private Sub CreateEmailItem(ByVal subjectEmail As String, _

ByVal toEmail As String, ByVal bodyEmail As String, _

ByVal AttachmentFiles As String)

Dim eMail As Outlook.MailItem = Me.CreateItem _

(Outlook.OlItemType.olMailItem)

With eMail

.Subject = subjectEmail

.To = toEmail

.Body = bodyEmail

.Importance = Outlook.OlImportance.olImportanceLow

For Each foundFile As String In My.Computer.FileSystem.GetFiles( folder, FileIO.SearchOption.SearchTopLevelOnly, "Aberdeen*.*")

.Attachments.Add(foundFile)

Next

.Send()

End With

End Sub






Re: Visual Studio Tools for Office Outlook configuration Problem

Mark Hogan

Mei,

Thanks for the reply, but these messages are not encrypted. This error may be when processing an Outlook item, but I think it is when actually processing the FOLDER properties. This is very strange in that the object model will get the collection of mail stores and will also get the root level folders from each mail store, but when I loop through each item of the collection and try to get the Folder's Name property, it errors out.

oFolders = oNameSpc.Folders
If Not oFolders Is Nothing Then
For i = 1 To oFolders.Count
strTemp = oFolders.Item(i).Name

Is there anything that I can possibly do
Has anyone seen this before

Thanks,

Mark





Re: Visual Studio Tools for Office Outlook configuration Problem

Mei Liang - MSFT

Mark -

Which account the addin is running under Will the same account be able to open Outlook folder and items in that folder

Thanks,

Mei





Re: Visual Studio Tools for Office Outlook configuration Problem

Mark Hogan

Mei,

Yes. This tool is being used by the person who "owns" the mail store (Exchange, PST, etc). They have rights to their data and they can see it in Outlook. All I can do is ask that anyone having this problem create a PST, copy some of the items into the PST and then test the PST. If they are still having problems, then they can send me the PST for testing.

Mark





Re: Visual Studio Tools for Office Outlook configuration Problem

Mark Hogan

Also, they get errors just trying to get the Name of the Mail Stores (first level folders). They can not even list the Exchange Mailbox or any PST they have loaded. The VSTO errors when Name or any property is accessed. So, my utility doesn't get past enumerating the mail stores as it can't do it.



Re: Visual Studio Tools for Office Outlook configuration Problem

Mei Liang - MSFT

I wonder if they get the right PIAs on the machine. Could you please check

Thanks,

Mei





Re: Visual Studio Tools for Office Outlook configuration Problem

Mark Hogan

Mei,

Here is what I do know:

  1. The user was on Windows XP, SP2 with latest MS Patches.
  2. Office 2003 Professional installed with SP2 and latest Patches.
  3. My software installed (VB.Net App utulizing VSTO 2005).
    1. Installed my software with a EXE and MSI created with Visual Studio. This setup checked for Office, .NET 2.0, Windows Installer 3, etc. and installed the required components.
    2. The Office 2003 PIA installed (O2003PIA.MSI) has a MSI Date of "April 5, 2005" and a MSI Revision Number of "{56F7B1A6-DAF2-422F-BFA7-D9257B28ECF0}". If they had anything newer, then the MSI would not downgrade it.
    3. VSTO Runtimes has a date of "April 6, 2006".

How can I check or have the user check what is installed Do you want me to gather the Uninstall data from the computer and get the Office Version, Office Installs, PIA Install, VSTOR install, and Other Office and Windows Patches I can write a script to get that information and have the users get it for me.

Let me know what I need to capture and I will get it.

Thanks,
Mark





Re: Visual Studio Tools for Office Outlook configuration Problem

Mei Liang - MSFT


Microsoft PSS has a VSTO 2005 client troubleshooter tool is an application designed to help diagnose potential client-side issues when deploying a VSTO 2005 solution.

You can download it from
http://www.microsoft.com/downloads/details.aspx FamilyId=C9FB6A54-8069-4918-A6F9-E744928DFAC3&displaylang=en

It would detect your Office Version, Office PIA, VSTO Runtime and .Net framework installed.

Hope it will help trouble shoot the problem on your customer's machine.

Thanks,
Mei
------------------------------------------------------------------------------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.





Re: Visual Studio Tools for Office Outlook configuration Problem

Mark Hogan

Mei,

Here are some results from a PC with the issue described. The trouble shooting tool seems to report that this is a good setup.

Thanks,
Mark




Re: Visual Studio Tools for Office Outlook configuration Problem

Mei Liang - MSFT

Mark -

Does your customer still experience the problem If yes, would you please have them to try open the message store using just VBA If they can't, you might be able to get a quicker response from outlook programming forums.

Thanks,

Mei





Re: Visual Studio Tools for Office Outlook configuration Problem

Shabash

Hi,

Am using Win XP and Off 2003.I have problem with my ms outlook. I have 2 IDs configured in MS Outlook.I am able to receive and send mails without any problem.But once i restart or shut down n start the system settings in the outlook will change.

Pop3 settings will change to lacalhost instead of pop3 ipadddress and the pop3 ipaddress will be present along with the mailid in the mail id field with a / inbetween mail id and pop3 ipaddress.

So can anyone try to help me in solving this issue.

Waiting for a flashy reply.





Re: Visual Studio Tools for Office Outlook configuration Problem

Sue Mosher - Outlook MVP

Shabash, your issue likely has nothing to do with VSTO programming, which is the subject of this forum. The symptoms suggest that you are running an anti-virus application that installs its own POP3 server.