|
Hi all,
I am a novice to the Exchange Server 2003. I am trying to create a meeting request using CDO, MAPI and ADODB using C#. My exchange server is 192.168.78.57. I have created two Active Directory Users viz. abc@testingserver.com and xyz@testingserver.com.
If I try to log into the Exchange Server using abc@testing server.com, I get an error stating that "You do not have permission to log on. [Microsoft Exchange Server Information Store - [MAPI_E_FAILONEPROVIDER(8004011D)]]" when the statement "mapiSession.Logon(....)" is executed.
To overcome this error, I used administrator@testingserver.com. After using this id for login purpose, I was able to get rid of the above error, but at the time of sending the appointment using "appointmentItem.Send(false, false, 0);" I am getting an another error "[Collaboration Data Objects - [MAPI_E_NO_SUPPORT(80040102)]]"
Please find herewith my code below
Is that I am missing something in this code??
Please Help me somebody as this is a bit urgent.
Kind Regards
Pratik
public void CreateNewMeetingRequest()
{
try
{
string exchangeServer = "192.168.78.57";
string currentUserMailBoxName = "abc@testingserver.com";
object profileInfo = (object)exchangeServer + "\n" + currentUserMailBoxName;
_Session mapiSession = new SessionClass();
object emptyObject = Missing.Value;
mapiSession.Logon(emptyObject, emptyObject, false, false, emptyObject, emptyObject, profileInfo);
MAPI.Folder folder = (MAPI.Folder) mapiSession.GetDefaultFolder(CdoDefaultFolderTypes.CdoDefaultFolderCalendar);
MAPI.Messages folderMessages = (Messages)folder.Messages;
MAPI.AppointmentItem appointmentItem = (MAPI.AppointmentItem) folderMessages.Add(emptyObject, emptyObject, emptyObject, emptyObject);
Recipients appointmentRecipient = (Recipients)appointmentItem.Recipients;
appointmentRecipient.AddMultiple("xyz@testingserver.com", CdoRecipientType.CdoTo);
appointmentRecipient.Resolve(false);
appointmentItem.ConversationIndex = mapiSession.CreateConversationIndex(Missing.Value);
appointmentItem.ConversationTopic = String.Empty;
appointmentItem.EndTime = DateTime.Today.AddHours(5.0);
appointmentItem.Location = "XYZ";
appointmentItem.Subject = "Subject - Test Appointment";
appointmentItem.Text = "Text - Test Appointment";
appointmentItem.StartTime = DateTime.Today;
appointmentItem.Sender = (MAPI.AddressEntry)mapiSession.CurrentUser;
appointmentItem.Send(false, false, 0);
mapiSession.Logoff();
folder = null;
folderMessages = null;
appointmentItem = null;
appointmentRecipient = null;
mapiSession = null;
}
catch (Exception exception)
{
Console.Write(exception.Message);
}
}
Thanking you in Advance
Regards
Pratik Shah
|
|
|
|
|
I am having difficulty filtering IP Addresses using IPAddress.TryParse()
I am trying to get upto speed with .NET programming, running MSVS 2005 .NET on Vista Home Pro.
System Config Notebook one ethernet + built-in WiFi.
On form load I request Internet Host Info and aquire numerous addresses, and add them to the listbox for selection
later.
The problem some do not reflect a true IP address are varied lengths some look like partial mac adresses etc, and are invalid for speific reasons hense the need to filter them.
Having stepped through debug I am now assuming the reason IPAddress.TryParse() is not filtering them is because the values are valid based on the AddressList[] static members:
Any, Broadcast, IPv6Any ... the list continues. Identifying IPv6Loopback as being the problem for the following scenario because IPv6Loopback contains {::1}
For simplicity, with no ethernet connection & WiFi disabled; I have 2 items in the listbox:
::1 (I regard as a problem)
127.0.0.1 (Loopback no problem)
The code:
string strIP = null;
IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
if (hostEntry.AddressList.Length > 0)
{
foreach (IPAddress ip in hostEntry.AddressList)
{
strIP = ip.ToString();
IPAddress tmpAddress;
if (IPAddress.TryParse(strIP, out tmpAddress))
{
socketListBox.Items.Add(strIP);
}
}
}
If my assumtion is correct how can I filter the items which cause phyical issues.
Regards
dotman1
|
|
|
|
|
use Dns.Resolve instead og Dns.GetHostEntry method
however the method is obsolete but it works fine
good luck
|
|
|
|
|
Thank you, this worked well.
Regards
dotman1
|
|
|
|
|
Yeah it works fine now but it'll probably get blasted in a future version of the framework. If a method is marked as obsolete it's a warning that you shouldn't use it if you want your code to be easily upgraded in the future.
|
|
|
|
|
I am aware of that, but until I can address the issue with the current framework this is a cleaner solution. Can you assist with this issue?
Regards
dotman1
|
|
|
|
|
I need to make application to view simultaneously, 4 mpg files, how can i do that, if i want to view frame by frame this mpgs synchronous.
|
|
|
|
|
Four windowsMediaPlayer controls, and a quad core processor ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I'm creating a Document Management System.
All the files are stored in DB.
When the users would view the files stored in DB, I would like it to be viewed like that of a Print Preview.
I want it this way so that they couldn't copy the text or save the file.
The files I support are doc, xls and pdf.
Can anyone help me with this?
Thanks and more power,
Arthur
|
|
|
|
|
The best way to stop people copying text, is to show it to them in a bitmap, instead of as text.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello Christian,
Ok thanks for your advice.
I'll try to find ways on converting the files to bitmap or any image.
Cheers,
Arthur
|
|
|
|
|
there is another way which is to convert the files to an XPS format. Then build your own custom XPS viewer. This may seem like a lot of work but alot of it is already done for you in .net framework 3.0.
|
|
|
|
|
Dear All,
I would like the time the execution time for a script. But I did not get any idea for using timer. Any Example for counting the time of running time in a simple way?
Thanks!
|
|
|
|
|
To time something, grab DateTime.Now before and after the operation
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi there .
There is an another way to do it .
Try to use Thread in Threading namespace . Something like following code :
<br />
private void StartThread()<br />
{<br />
Thread thd1 = new Thread(new ThreadStart(Your_Function());<br />
thd1.Start();<br />
<br />
}<br />
<br />
<br />
private void Your_Function()<br />
{<br />
}<br />
Important : If your function get any parameter Use ParameterizedThreadStart delegate instead of ThreadStart
DMASTER
|
|
|
|
|
where is the timing information ?
Developer611 wrote: your function will be execute on per second
what is the meaning of this ?
the new thread will start immediately and execute the method once...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
how to start a form maximized ?
-- modified at 23:58 Tuesday 7th August, 2007
|
|
|
|
|
Set it's WindowState property accordingly, either in code, or the designer.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
what should i do if i have an error in ISynchronizeInvoke casting.
Actually i am doing a c# console application that use ISynchronizeInvoke
the code is like this:
ISynchronizeInvoke i = (ISynchronizeInvoke)this;
The Error:
Unable to cast object of type 'ArtIntelTania.Program' to type 'System.ComponentModel.ISynchronizeInvoke'.
hope somebody can help me
Thanks in advance
Regard,
jac
|
|
|
|
|
Consoles don't implement ISynchronizeInvoke . You'll need a Form or Control for that.
Can you describe in more detail what you're trying to acheive?
|
|
|
|
|
oic...
Actually the idea is like this:
- i want to display all the record(s) inside the database
- the connection is always there, so that i can retrieve the records. For an example, if i insert a new data the data will be displayed instantly (no need to refresh or debug once again).
thanks,
Jac
|
|
|
|
|
jacklynn_mei wrote: - i want to display all the record(s) inside the database
- the connection is always there, so that i can retrieve the records. For an example, if i insert a new data the data will be displayed instantly (no need to refresh or debug once again).
I don't know much about using databases. I'm guessing you'd probably have to hook into some event that is raiesed when the database changes and then display the update in your UI. A Form based application would probably be better for this than a Console application.
|
|
|
|
|
I want to control the Office Word's behavior using C#.
i.e. Create a new word document in local PC with specified path.
And if I open a remote word document I could control that when user close the document,Word should not quest a saving path but save the change into the remote region path(if the user selected save the change).
Becides these,I also want to know whcich behaviors that the Office Word have and I can retrieve these messages?
Thanks.
GOOD LUCK.
|
|
|
|
|
Hi,
Do you wish to open the Word doc from another process? Do you wish to populate it? Would you like to automate the creation of documents, either before Word opens or by helping the user after it has opened?
Basically to open Word with a new document you need to do the following:
First create a new Windows Forms project. Add a button to the default form.
Next add a reference to the Microsoft Office 12.0 Object Library & Microsoft Word 12.0 Object Library (for Office 2007) so you have access to the word objects. The Office 12.0 Object library is not strictly necessary, but you may find you need it to complete other operations further down the track.
Next use the following as the code behind for Form1:
using System.Windows.Forms;<br />
using Word = Microsoft.Office.Interop.Word;<br />
<br />
namespace WordSample<br />
{<br />
public partial class Form1 : Form<br />
{<br />
private object m_Missing = Type.Missing;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
Word.Application word = new Word.Application();<br />
<br />
Word.Document wordDoc = new Word.Document();<br />
<br />
word.Visible = true;<br />
<br />
wordDoc.Application.DocumentBeforeSave += new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentBeforeSaveEventHandler(Application_DocumentBeforeSave);<br />
wordDoc = word.Documents.Add(ref m_Missing, ref m_Missing, ref m_Missing, ref m_Missing);<br />
<br />
}<br />
<br />
void Application_DocumentBeforeSave(Microsoft.Office.Interop.Word.Document Doc, ref bool SaveAsUI, ref bool Cancel)<br />
{<br />
}<br />
<br />
}<br />
}<br />
<br />
That will create a new instance of word. To modify the closing behaviour there are a number of events available to you including the Application.DocumentBeforeSave or Application.DocumentBeforeClose events. I have included a dummy ApplicationBeforeSave event for you. There is extensive documentation on MSDN regarding the Word ObjectModel that lists all events (http://msdn2.microsoft.com/en-us/library/kw65a0we(vs.80).aspx[^]; http://msdn2.microsoft.com/en-us/library/aa192495(office.11).aspx[^] should get you started, there is also plenty about Office 12/2007 you'll find from there).
If you have any further questions please feel free to ask away. You also have a lot more options for automating word via VSTO with Document or Application level customisations that you may wish to consider.
Hope that helps, good luck and have fun
Toby Russell
Software Engineer
|
|
|
|
|
Thanks.
Although I am a beginer of C#,but I will glad to have a try.
Best wishes.
|
|
|
|