View Single Post
  #3 (permalink)  
Old April 18th, 2010, 11:44 PM
sid sid is offline
Registered User
Join Date: Apr 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default 'System.Web.HttpApplicationState' does not contain a definition for 'Session'

Hi Imar,

Below are the namespaces I am using

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using AbsenceTrackingSystem;
using Outlook = Microsoft.Office.Interop.Outlook;

I tried as below in the code:

AbsenceTrackingSystem app = (HttpContext.Current.ApplicationInstance);

Its telling AbsenceTrackingSystem is a namespace & used as a type.

could you help me by writing that piece of code in the namespace or in the code below:

private void GetDistributionListMembers()

AbsenceTrackingSystem app = HttpContext.Current.ApplicationInstance;

if (app != null)
Outlook.SelectNamesDialog snd = Application.Session.GetSelectNamesDialog();
Outlook.AddressLists addrLists = Application.Session.AddressLists;
foreach (Outlook.AddressList addrList in addrLists)
if (addrList.Name == "All Groups")
snd.InitialAddressList = addrList;
snd.NumberOfRecipientSelectors = Outlook.OlRecipientSelectors.olShowTo;
snd.ToLabel = "D/L";
snd.ShowOnlyInitialAddressList = true;
snd.AllowMultipleSelection = false;
if (snd.Recipients.Count > 0)
Outlook.AddressEntry addrEntry = snd.Recipients[1].AddressEntry;
if (addrEntry.AddressEntryUserType == Outlook.OlAddressEntryUserType.olExchangeDistribut ionListAddressEntry)
Outlook.ExchangeDistributionList exchDL = addrEntry.GetExchangeDistributionList();
Outlook.AddressEntries addrEntries = exchDL.GetExchangeDistributionListMembers();
if (addrEntries != null)
foreach (Outlook.AddressEntry exchDLMember
in addrEntries)