Interop - Cannot create folder in outlook when computer is domain

T

TimothyP

I have an application (C# .NET 3.5) which needs to access Outlook.
I create new folders in the calendar folder and add AppointmentItems to it
(from the Office Interop libraries).

It works fine, but not if the computer is part of a domain where Outlook is
linked to Exchange.
When creating a new folder for example (to contain AppointmentItem objects)
I simply get an exception
"Cannot Create Folder"

Does anybody know what needs to be done in order to allow my application to
create folders in Outlook?

Another problem I'm facing is that with Outlook 2003 it seems the user can
only grant my
application access for 10 minutes. (Office 2007 does not seem to have this
limitation).

The idea behind my application is that it runs in the background,
synchronizing with another data source
continuously. So they get a lot of messages form outlook asking to grant my
application access to Outlook.


Thank you.
 
K

Ken Slovak - [MVP - Outlook]

Actually, this is the correct group for this question. It's misleading but
the interop group was created long before managed code existed and was
originally intended for questions about Outlook interoperability with other
programs.

Whether or not you can create a folder has nothing to do with Exchange
usage, assuming you have Exchange permissions to create folders in that mail
store. The code would be identical. I've never had to change or modify code
to work with Exchange that worked with PST files.

Where are these folders located, in an Exchange mailbox or public folder or
delegate mailbox? Have you checked folder permissions and store permissions
relative to the logged in user who's running your code?

The access warnings should not occur with the addin running in Outlook 2003
if you are correctly deriving your Outlook objects. Those are due to the
security limitations of the Outlook object model guard.

Are you deriving all of your Outlook objects from the Application object
passed to you in the OnConnection() event handler? That should make them all
trusted and not fire the security warnings. You get Application in
OnConnection() and assign that to an Outlook.Application object that has
scope for the life of your addin. You then use that object to derive all
subsequent child objects.
 
T

TimothyP

Hi,

I'll look into the access rights,
but I should mention my application is not an Outlook add-on,
it's actually a standalone WPF application which uses Windows Workflow
Foundation and some activities of the workflow access calendars and
appointment items in Outlook.

Timothy.
 
K

Ken Slovak - [MVP - Outlook]

In that case anything I said about using a trusted Application object is out
the window for a standalone application. For Outlook 2003 you are then
completely at the mercy of the Outlook object model guard.

Review the information at this link to see about that and how to avoid
triggering the security: http://www.outlookcode.com/article.aspx?id=52
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top