Microsoft Content Management Server - CMS Email

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > November 2004 > CMS Email





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author CMS Email
Joey

2004-11-01, 8:46 pm

Hi,

I'm getting the following message in my code.
System.NullReferenceException: Object reference not set
to an instance of an object. I don't see what im doing
wrong. Help!!! Thanks..

Line 56:
dirSearcher.PropertiesToLoad.Add("mail");
Line 57: SearchResult
result = dirSearcher.FindOne();
Line 58: string MailAddr =
result.Properties["mail"][0].ToString();
Line 59:
dirSearcher.Dispose();
Line 60: dirEntry.Dispose
();
Angus Logan [MVP]

2004-11-01, 8:46 pm

Hi Joey,

Which line is throwing the exception? & can you post the exception stack?

Regards
--
________________________________________


Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
Product Specialist
Microsoft Application Solutions
Data#3 Limited
E angus_logan@data3.com.au
BLOG www.anguslogan.com
________________________________________

"Joey" <anonymous@discussions.microsoft.com> wrote in message
news:233301c4c072$00f111e0$a401280a@phx.gbl...
> Hi,
>
> I'm getting the following message in my code.
> System.NullReferenceException: Object reference not set
> to an instance of an object. I don't see what im doing
> wrong. Help!!! Thanks..
>
> Line 56:
> dirSearcher.PropertiesToLoad.Add("mail");
> Line 57: SearchResult
> result = dirSearcher.FindOne();
> Line 58: string MailAddr =
> result.Properties["mail"][0].ToString();
> Line 59:
> dirSearcher.Dispose();
> Line 60: dirEntry.Dispose
> ();



Stefan [MSFT]

2004-11-02, 2:46 am

Hi Joey,

also post the complete code.
Btw: this is code that accesses active directory.

A post to an AD related newsgroup might be more helpful.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Angus Logan [MVP]" <angus_logan@data3.com.au> wrote in message
news:etyQQ#HwEHA.728@TK2MSFTNGP11.phx.gbl...
> Hi Joey,
>
> Which line is throwing the exception? & can you post the exception stack?
>
> Regards
> --
> ________________________________________

>
> Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
> Product Specialist
> Microsoft Application Solutions
> Data#3 Limited
> E angus_logan@data3.com.au
> BLOG www.anguslogan.com
> ________________________________________

> "Joey" <anonymous@discussions.microsoft.com> wrote in message
> news:233301c4c072$00f111e0$a401280a@phx.gbl...
>
>



Joey

2004-11-02, 5:50 pm

The line thats giving me the exception is

Line 58: string MailAddr =
result.Properties["mail"][0].ToString();

Is there some other way to get this up and working. I'm
just having trouble pulling email addresses from AD even
though i'm using the exact same code as Stefan put on his
site:

Stack Trace:


[NullReferenceException: Object reference not set to an
instance of an object.]
Microsoft.ContentManagement.Publishing.Posting.Submit
() +129

Microsoft.ContentManagement.WebControls.ConsoleControls.Su
bmitAction.PerformActionBehavior() +44

Microsoft.ContentManagement.WebControls.ConsoleControls.Ba
sePostbackAction.RaisePostBackEvent(String eventArgument)
+36
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1277





>-----Original Message-----
>Hi Joey,
>
>Which line is throwing the exception? & can you post the

exception stack?
>
>Regards
>--
> ________________________________________

>
>Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
>Product Specialist
>Microsoft Application Solutions
>Data#3 Limited
>E angus_logan@data3.com.au
>BLOG www.anguslogan.com
> ________________________________________

>"Joey" <anonymous@discussions.microsoft.com> wrote in

message
>news:233301c4c072$00f111e0$a401280a@phx.gbl...
>
>
>.
>

Angus Logan [MVP]

2004-11-02, 5:50 pm

Hi Joey,

Can you step over the code in debug mode and see which object is set to
nothing?

results?; properties?

Regards
--
________________________________________


Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
Product Specialist
Microsoft Application Solutions
Data#3 Limited
E angus_logan@data3.com.au
BLOG www.anguslogan.com
________________________________________

"Joey" <anonymous@discussions.microsoft.com> wrote in message
news:14cf01c4c13b$2e4dfa30$a501280a@phx.gbl...[vbcol=seagreen]
> The line thats giving me the exception is
>
> Line 58: string MailAddr =
> result.Properties["mail"][0].ToString();
>
> Is there some other way to get this up and working. I'm
> just having trouble pulling email addresses from AD even
> though i'm using the exact same code as Stefan put on his
> site:
>
> Stack Trace:
>
>
> [NullReferenceException: Object reference not set to an
> instance of an object.]
> Microsoft.ContentManagement.Publishing.Posting.Submit
> () +129
>
> Microsoft.ContentManagement.WebControls.ConsoleControls.Su
> bmitAction.PerformActionBehavior() +44
>
> Microsoft.ContentManagement.WebControls.ConsoleControls.Ba
> sePostbackAction.RaisePostBackEvent(String eventArgument)
> +36
> System.Web.UI.Page.RaisePostBackEvent
> (IPostBackEventHandler sourceControl, String
> eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent
> (NameValueCollection postData) +138
> System.Web.UI.Page.ProcessRequestMain() +1277
>
>
>
>
>
> exception stack?
> message


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com