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.
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.
04-05-2012 09:44 AM
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 object. I'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
Solved! Go to Solution.
04-05-2012 09:52 AM
You may want to review this community document:
Using the .NET IEnumerator Interface in LabVIEW
04-05-2012 11:22 AM
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
04-30-2012 10:13 AM
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
11-25-2017 08:26 PM
11-27-2017 03:43 PM
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.