I am modifying the following code, and continue to get a error message stating:
The type or namespace name 'Session' could not be found (are you missing a using directive or an assembly reference?)
This is my code:
Then of course mapiSession is referenced throughout the program in various places. I am not sure what Assembly I need to add in order to get Session recognized and usable. Any assistance would be greatly appreciated. I am also getting the same error on "AddressEnt ry" below.
Again AddressEntry is referenced throughout the rest of the code as well.
This also is happening on 'Attachments'
If anyone can assist me on what assemblies need to be referenced, or what I am doing wrong - I would really appreciate it!
The type or namespace name 'Session' could not be found (are you missing a using directive or an assembly reference?)
This is my code:
Code:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Net;
using System.Net.Mail;
using System.ServiceProcess;
using System.Timers;
using System.IO;
using System.Reflection;
using MySql.Data.MySqlClient;
namespace EmailMaintHelpDesk
{
public class EmailToMaintTicketService : System.ServiceProcess.ServiceBase
{
private const string EmailServer = "mail";
private const string EmailAccount = "mail\nmainthd";
private const string ITEmail = "email goes here";
private const string LogFilePath = "C:\\EmailHk\\logs\\EmailHk.log";
private const string TTSExePath = "c:\\soe\\cgi-bin\\tts-cmd.exe";
private const string TTSExeWorkingDirectory = "c:\\soe\\cgi-bin\\";
private const string AttachmentFolder = "c:\\SOE\\pub\\attachments";
private const string ttsConnectionString = "Server=localhost;Database=NAME;Uid=ID;Pwd=PW";
private const int TimerInterval = 120000;
private System.ComponentModel.Container components = null;
private Timer serviceTimer = null;
private StreamWriter log = null;
private [B]Session[/B] mapiSession = null;
Code:
private string GetEmailAddress([B]AddressEntry[/B] emailSender)
{
string exchangeAddress = emailSender.Address.ToString().ToLower();
int aliasStart = exchangeAddress.LastIndexOf("=") + 1;
int aliasLength = exchangeAddress.Length - aliasStart;
if (aliasStart > 0)
{
string alias = exchangeAddress.Substring(aliasStart, aliasLength);
return String.Format("{0}@something.com", alias);
}
else
{
log.WriteLine(DateTime.Now.ToString() + ": Sender email couldnt be determined -> " + exchangeAddress);
return "email goes here";
}
}
This also is happening on 'Attachments'
Code:
private void ProcessAttachments([B]Attachments[/B] messageAttachments,
double unixTimestamp)
{
int numberOfAttachments = (int) messageAttachments.Count;
if (numberOfAttachments == 0)
return;
int ticketNo = GetTicketNumber(unixTimestamp);
for (int i=1; i<numberOfAttachments+1; i++) {
Attachment messageAttachment
= (Attachment) messageAttachments.get_Item(i);
string filename = (string) messageAttachment.Name;
string attachmentPath = String.Format(
"{0}\\{1}-1\\{2}",
AttachmentFolder,
ticketNo,
filename
);
log.WriteLine(attachmentPath);
messageAttachment.WriteToFile(attachmentPath);
UpdateAttachmentsTable(filename, ticketNo);
}
}
Comment