From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get email IDs from Exchange Server using LDAP without having local Outlook? I got succeed, need help.

Solved!
Go to solution

Hi Folks,  

 

My LabVIEW tool got a eMail capability. In order to search email IDs by name, i need to have this solution. I've tried with VB.Net code which works well. Now, I'm in a situation to convert my VB .Net code to LabVIEW 8.5; Able to convert 90%; I’m not able to read email IDs from SearchResultCollection objectI've attached my VI . Would you guys help me ?

 

NOTE: For VB.Net, Add "System.DirectoryServices" from reference

 

**************************************

Imports system.DirectoryServices

 

Public Function GetEmail(ByVal ntname AsString) AsString

 

Dim objsearch AsNewDirectorySearcher() 

Dim strrootdse AsString= objsearch.SearchRoot.Path 

Dim objdirentry AsNewDirectoryEntry(strrootdse)

 

objsearch.Filter = "(& (| (givenName=" & ntname.Trim() & ")(sn=" & ntname.Trim() & "))(objectClass=user))"

'objsearch.Filter = "(& (mailnickname=" + ntname.Trim() + ")(objectClass=user))";

objsearch.SearchScope = System.DirectoryServices.SearchScope.Subtree

objsearch.PropertiesToLoad.Add("mail")

objsearch.PropertyNamesOnly =True

 

Dim colresults AsSearchResultCollection = objsearch.FindAll() 

Dim arl AsString = ""

 

'Search eMail IDs by First name

ForEach objresult As SearchResult Incolresults 

arl = ((arl + objresult.GetDirectoryEntry().Properties("mail").Value & ","))

'TextBox1.Text = arl

Next

 

If arl.Length > 0 Then

arl = arl.Substring(0, arl.Length - 1)

EndIf

 

MessageBox.Show(arl)

objsearch.Dispose()

Return arl

 

EndFunction

**************************************

Thanks

0 Kudos
Message 1 of 6
(4,193 Views)

You may want to review this community document:

 

Using the .NET IEnumerator Interface in LabVIEW

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 2 of 6
(4,191 Views)

Thanks for sending the link.

 

I've treid my best. Getting an error; not able to get to work. Here is my VI attachment.

 

Let me know, if you've any suggestions.

 

Thanks

0 Kudos
Message 3 of 6
(4,173 Views)
Solution
Accepted by topic author Blessing_Star

I have found an solution by converting VB.Net code as DLL. I'm able to retrieve all (First, Last Name, eMail ID, user infos, etc...) information through DLL from LabVIEW. I've found more useful info from this link,

 

Query Exchange server and retrive email address from NT Username - http://www.codeproject.com/Articles/19985/Query-Exchange-server-and-retrive-email-address-fr

 

Thanks

0 Kudos
Message 4 of 6
(4,094 Views)
Please refer attached VI. but after upgrade to win10 and office365, this vi does not work, who can help to solve this issus to make this vi to support win10 and office 365? thanks.
0 Kudos
Message 5 of 6
(3,202 Views)

Ronke,

 

This forum post is a little old. I would recommend creating a new post and link this one. This way you can receive more traffic for people to suggest ideas.

 

0 Kudos
Message 6 of 6
(3,183 Views)