Problem creating folder in Outlook Add-In.

  • Thread starter Paulo Braz Figueiredo
  • Start date
P

Paulo Braz Figueiredo

Hello,

I developed an Outlook Add-In and his setup project. When in startup my
tries to create a new folder:

this._tasks_folder =
(Outlook.MAPIFolder)this.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
Outlook.MAPIFolder sent_folder =
(Outlook.MAPIFolder)this.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);
string folder_name_sent_sms = "NEW FOLDER";
try {
sent_folder.Folders.Add(folder_name_sent_sms,
Outlook.OlDefaultFolders.olFolderContacts);
}
catch {}

In development machine every thing works fine. But, when I deploy to other
machine the folder is not created! Anybody have idea why it isn’t created?

Thanks in advance for any help provided,

Paulo Figueiredo.
 
K

Ken Slovak - [MVP - Outlook]

Is your code actually running on the deployment machine? Is there an
ActiveExplorer object or is that object null? Does it help if you use
GetNameSpace("MAPI") instead of using Explorer.Session?
 
P

Paulo Braz Figueiredo

Hy,

I tried to use the GetNamespace statement instead of Explorer.Session but
nothing happened! I don’t have a clue about what’s happening! There is any
other way of doing that?

Thanks,

Paulo Figueiredo.
 
K

Ken Slovak - [MVP - Outlook]

Session and GetNameSpace("MAPI") are roughly equivalent but using
GetNameSpace will log you in if not already logged in. So on first accesses
it's usually better to use that.

You're going to have to do some debugging on this to see where and why your
code isn't running. That's the drift of the questions I asked. Add code to
write to an error log file at various touchpoints in your code so you know
those points are being hit. Also record any errors. That at least should
tell you if your code is running at all and if so where it's failing.
 
P

Paulo Braz Figueiredo

I know that my code is running. I see folders being created but then, when
the startup ends the folders disappear. I don’t understand what’s happening!
May this be a garbage collection issue? May be add-in permissions?

Thanks for the help,

Paulo Figueiredo.
 

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