473,387 Members | 1,520 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,387 software developers and data experts.

What Assembly contains 'Session'

36
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:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Diagnostics;
  6. using System.Net;
  7. using System.Net.Mail;
  8. using System.ServiceProcess;
  9. using System.Timers;
  10. using System.IO;
  11. using System.Reflection;
  12. using MySql.Data.MySqlClient;
  13.  
  14. namespace EmailMaintHelpDesk
  15. {
  16.     public class EmailToMaintTicketService : System.ServiceProcess.ServiceBase
  17.     {
  18.         private const string EmailServer = "mail";
  19.         private const string EmailAccount = "mail\nmainthd";
  20.         private const string ITEmail = "email goes here";
  21.         private const string LogFilePath = "C:\\EmailHk\\logs\\EmailHk.log";
  22.         private const string TTSExePath = "c:\\soe\\cgi-bin\\tts-cmd.exe";
  23.         private const string TTSExeWorkingDirectory = "c:\\soe\\cgi-bin\\";
  24.         private const string AttachmentFolder = "c:\\SOE\\pub\\attachments";
  25.         private const string ttsConnectionString = "Server=localhost;Database=NAME;Uid=ID;Pwd=PW";
  26.         private const int TimerInterval = 120000;
  27.         private System.ComponentModel.Container components = null;
  28.         private Timer serviceTimer = null;
  29.         private StreamWriter log = null;
  30.         private Session mapiSession = null;
  31.  
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 "AddressEntry" below.
Expand|Select|Wrap|Line Numbers
  1. private string GetEmailAddress(AddressEntry emailSender)
  2.         {
  3.             string exchangeAddress = emailSender.Address.ToString().ToLower();
  4.  
  5.             int aliasStart = exchangeAddress.LastIndexOf("=") + 1;
  6.             int aliasLength = exchangeAddress.Length - aliasStart;
  7.             if (aliasStart > 0) 
  8.             {
  9.                 string alias = exchangeAddress.Substring(aliasStart, aliasLength);
  10.                 return String.Format("{0}@something.com", alias);
  11.             } 
  12.             else 
  13.             {
  14.                 log.WriteLine(DateTime.Now.ToString() + ": Sender email couldnt be determined -> " + exchangeAddress);
  15.                 return "email goes here";
  16.             }
  17.         }
  18.  
Again AddressEntry is referenced throughout the rest of the code as well.

This also is happening on 'Attachments'
Expand|Select|Wrap|Line Numbers
  1. private void ProcessAttachments(Attachments messageAttachments, 
  2.             double unixTimestamp) 
  3.         {
  4.             int numberOfAttachments = (int) messageAttachments.Count;
  5.             if (numberOfAttachments == 0) 
  6.                 return;
  7.             int ticketNo = GetTicketNumber(unixTimestamp);
  8.             for (int i=1; i<numberOfAttachments+1; i++) {
  9.                 Attachment messageAttachment 
  10.                     = (Attachment) messageAttachments.get_Item(i);
  11.                 string filename = (string) messageAttachment.Name;
  12.                 string attachmentPath = String.Format(
  13.                     "{0}\\{1}-1\\{2}",
  14.                     AttachmentFolder, 
  15.                     ticketNo, 
  16.                     filename
  17.                 );
  18.          log.WriteLine(attachmentPath);
  19.                 messageAttachment.WriteToFile(attachmentPath);
  20.                 UpdateAttachmentsTable(filename, ticketNo);
  21.             }
  22.         }
  23.  
If anyone can assist me on what assemblies need to be referenced, or what I am doing wrong - I would really appreciate it!
Nov 2 '10 #1

✓ answered by Curtis Rutland

I honestly don't know what assembly that object is from. You haven't really given much context. But I haven't worked with this kind of thing, so I really don't know what it might be.

I'd suggest trying to find documentation from whomever you inherited this code from.

7 4145
Curtis Rutland
3,256 Expert 2GB
Probably the Microsoft.Office.Interop.Outlook namespace in the Microsoft.Office.Interop.Outlook.dll dll.
Nov 2 '10 #2
brat33
36
When I try to add the line of code "Using Microsoft.Office.Interop.Outlook", I receive a error message that Office is not valid for namespace Microsoft. Would I just need to reference this within the solution for the dll? I am not sure what to do with this piece of information. I was expecting to add another USING line at the top of the page, but this does not seem to be the case.
Nov 2 '10 #3
Curtis Rutland
3,256 Expert 2GB
Well, if it's this AddressEntry, you'll have to add a reference to Microsoft.Office.Interop.Outlook.dll to your project.

Look at the error message:
(are you missing a using directive or an assembly reference?)
Lots of people don't know about the second half. You have to add a reference to a DLL before you can reference a namespace defined in that DLL. Visual Studio automatically references several DLLs for you by default, which is why just adding the Using directives is enough for them.

Using directives are a convenience; syntactic sugar. References are not.

Once you've added the reference, then you can add the using directive.
Nov 2 '10 #4
brat33
36
Thanks for the additional info - that did take care of two of my three issues.

The type or namespace name 'Session' could not be found (are you missing a using directive or an assembly reference?)

Would you happen to know what I need to reference in order to use Session?

Thank you so very much with the help on the other two - I have been fighting with this for over a week...Was sure I would be able to figure it out, but no luck!
Nov 3 '10 #5
Curtis Rutland
3,256 Expert 2GB
I honestly don't know what assembly that object is from. You haven't really given much context. But I haven't worked with this kind of thing, so I really don't know what it might be.

I'd suggest trying to find documentation from whomever you inherited this code from.
Nov 3 '10 #6
brat33
36
Thanks again for all of your help! I was able to figure it out - I added a few more references and it seemed to accomplish what I wanted it to! Just took some more searching in addition to what I had already found! Session is in the System.Web.Mail reference!
Nov 4 '10 #7
Curtis Rutland
3,256 Expert 2GB
Glad you found it. Just so you know, System.Web.Mail is pretty obsolete now. If you're developing new email applications, use System.Net.Mail.
Nov 4 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is...
5
by: Gmmi | last post by:
Is it true that when your ASP application jump's from one Virtual Directory to another Virtual directory then you cannot access session variables (which you created in previous virtual directory...
1
by: Werner | last post by:
Hi Patrick! Can you give an example of how to use a frameset inside an aspx-file? When I create a new frameset in Visual Studio.Net it just gives me a htm-File. Or give me a link where I can...
4
by: Sarah Marriott | last post by:
Our website contains session variables that are used to validate if a user is logged in etc. We have found that these variables are randomly lost while navigating the website. We set up some...
2
by: ras26 | last post by:
I have a WebSite "App1" which has an external assembly "Lib1". Inside this external assembly we have developed some classes that derive from "System.Web.UI.Page". One of these pages is called...
2
by: HLady | last post by:
I have a sequence of clicks in my apps that are always causing the session to start again. This is definitely not being caused by a timeout, cause it always happens no matter how long since the...
12
by: TC | last post by:
I'm trying to figure out what the "Friend" keyword does. I know it specifies that "elements are accessible from within the same assembly", but that doesn't help because I don't know what an...
0
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, Mysteriously, the components for the Toolbox for Report Items (RDLC reports - VS2005 - designer) have all changed to Textbox. There is no List component, Matrix, Table, Line, Chart,...
12
by: MrHelpMe | last post by:
Hello again all, I've finished my whole application and now I don't like the whole session variables that I am using. I have a form, user fills in info clicks submit and using CDOSYSMail an...
0
by: kanaille11 | last post by:
Hi, at the moment we have very strange problems with assembly directories: Following is the main structure of our project: - An ActiveX-control in "d:\TheProject\bin\debug" which is developed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.