473,378 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Outlook 10 Interop Issues

When trying to call this class to create an item in a public folder, I get
the following error:

Server execution failed

at VRInterop.Appointment.FindPublicFolder(String folderName) at
VRInterop.Appointment..ctor(String publicFolder, String subject, String body)
at VR.Confirm.ibtConfirm_Click(Object sender, ImageClickEventArgs e) in
c:\inetpub\wwwroot\vr\confirm.aspx.cs:line 162

VRInterop
The application calling this class is an ASP.Net app in C#. The server is
2000 Server and it has Office XP installed. There is a public folder
residing in Exchange 2000 and windows authentication is being used across the
board.

Any assistance is greatly appreciated.
public class Appointment
{
private Ol.MAPIFolder TaskFolder;
private Ol.Items tasks;
private string m_subject;
private string m_body;
public Appointment(string publicFolder, string subject, string body)
{
// Get a reference to the folder
TaskFolder = this.FindPublicFolder(publicFolder);
//Get a collection of the tasks
tasks = this.GetTasks();
//Set the subject and body
m_subject = subject;
m_body = body;
//Create the Appointment
this.Create();
}

private Ol.Items GetTasks()
{
/* GetTasks()
* This function returns a collection of task
* items from the specified folder object */
//Get the collection of items in the folder's default type
Ol.Items result = TaskFolder.Items;
return result;
}

public void Create()
{
/*The logic to creating the appointment(task) is simply
grabbing
* a reference to the collection of tasks within the folder and adding
* a new item, setting its properties and saving it. */

//Adding a task requires a cast. I honestly don't know why,
//but I got this from MSDN sample code.
Ol.TaskItem ti = (Ol.TaskItem)tasks.Add("IPM.Task");
ti.Subject = m_subject;
ti.Body = m_body;
ti.Save();
}

public Ol.MAPIFolder FindPublicFolder(string folderName)
{
/* FindPublicFolder()
* This function takes a string representing a folder
* and returns that object */

//Open the Outlook application
Ol._Application olApp = new Ol.ApplicationClass();
//Get a MAPI folder reference
Ol._NameSpace olNS = olApp.GetNamespace("MAPI");
//Iterate through folder hierarchy
//Get Upper Level folder set
Ol._Folders oFolders;
oFolders = olNS.Folders;
//Get the Public folder collection
Ol.MAPIFolder oPublicFolder = oFolders.Item("Public Folders");
oFolders = oPublicFolder.Folders;
//Get the All Public folders collection
Ol.MAPIFolder oAllPFolder = oFolders.Item("All Public Folders");
oFolders = oAllPFolder.Folders;
//Get the folder you're looking for
Ol.MAPIFolder oMyFolder = oFolders.Item(folderName);
return oMyFolder;
}

public override string ToString()
{
// Overridden from System.Object to produce something
// intelligent for the developer to see when needed.
string result = "Appointment Class\n";
result += "Current Folder: " + this.TaskFolder.Name.ToString() + "\n";
Ol.Items items = this.GetTasks();
result += "Item Count: " + items.Count.ToString();
return result;
}

}

Ryan Brady
rb****@schools.org
Nov 19 '05 #1
0 1188

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: W Akthar | last post by:
Hi All, I have created a simple Windows Service which needs to be able to send appointments to Outlook. I have no problem makeing a reference to Microsoft Outlook 11.0 Object Library and...
6
by: Boris Tabenkin | last post by:
Hi all, I want to apologize if this is the wrong forum for this question. I would like to write an application, in Java running on UNIX, that would insert, read, and mark as completed tasks in...
4
by: John | last post by:
Hi Does anyone have a vb.net example of how to use redemption to send mail through outlook? Many Thanks Regards
9
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
9
by: H. Dederichs | last post by:
Hello NG, I would like to read and write Outlook PST-Files with my VB.NET application natively. Is there anyone who can help me with this issue? Since PST-Files are "also" Databases, aren't...
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
4
by: Brian Hampson | last post by:
I recently upgraded to Outlook 2007 B2TR and have found that I can no longer code against MAPI.DLL It's gone :( Using C#, I used to get the MAPI session, and from that I could change the out of...
3
by: mwolowski | last post by:
Hello, I'd like to add tasks, appointments, etc using c# to outlook For example i added reference using OutLook = Microsoft.Office.Interop.Outlook; and the code: 1. ---------------------...
1
by: =?Utf-8?B?cm9i?= | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox...
1
by: allbelonging | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.